Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/models/learning_outcome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def self.permissions
convenor_role_permissions = [
:update,
:get_los,
:update_glos,
:upload_csv,
:create_feedback_chips,
:get_feedback_chips
Expand All @@ -36,8 +35,7 @@ def self.permissions

tutor_role_permissions = [
:update,
:get_los,
:update_glos
:get_los
]

auditor_role_permissions = [
Expand Down
6 changes: 2 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ def self.permissions
:get_scorm_token,

:get_feedback_chips,
:get_los,
:update_glos
:get_los
]

# What can tutors do with users?
Expand All @@ -406,8 +405,7 @@ def self.permissions
:get_scorm_token,

:get_feedback_chips,
:get_los,
:update_glos
:get_los
]

# What can students do with users?
Expand Down
23 changes: 23 additions & 0 deletions test/api/feedback/learning_outcome_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,29 @@ def test_update_global_outcome
assert_json_matches_model learning_outcome, last_response_body, %w[id context_id context_type abbreviation short_description full_outcome_description]
end

def test_tutors_and_convenors_cannot_manage_global_outcomes
learning_outcome = FactoryBot.create(:learning_outcome, context_id: nil, context_type: nil,
short_description: 'Original')
new_abbreviation = FactoryBot.build(:learning_outcome).abbreviation
new_outcome = { abbreviation: new_abbreviation, short_description: 'New outcome' }

[FactoryBot.create(:user, :tutor), FactoryBot.create(:user, :convenor)].each do |user|
add_auth_header_for user: user

post_json 'api/global/outcomes', new_outcome
assert_equal 403, last_response.status
assert_nil LearningOutcome.global_outcomes.find_by(abbreviation: new_abbreviation)

put_json "api/global/outcomes/#{learning_outcome.id}", short_description: 'Changed'
assert_equal 403, last_response.status
assert_equal 'Original', learning_outcome.reload.short_description

delete "api/global/outcomes/#{learning_outcome.id}"
assert_equal 403, last_response.status
assert LearningOutcome.exists?(learning_outcome.id)
end
end

def test_create_task_definition_learning_outcome
task_definition = FactoryBot.create(:task_definition, outcome_count: 0)
data_to_post = {
Expand Down
Loading