Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 403 when TAs try to access Edit Assessment page #6343

Merged
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
6 changes: 6 additions & 0 deletions app/models/course/assessment/assessment_ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def allow_staff_delete_own_assessment_submission
end

def define_teaching_staff_assessment_permissions
allow_teaching_staff_read_tab_and_categories
allow_teaching_staff_manage_assessments
allow_teaching_staff_grade_assessment_submissions
allow_teaching_staff_manage_assessment_annotations
Expand All @@ -162,6 +163,11 @@ def define_teaching_staff_assessment_permissions
disallow_teaching_staff_delete_assessment_submissions
end

def allow_teaching_staff_read_tab_and_categories
can :read, Course::Assessment::Tab, category: { course_id: course.id }
can :read, Course::Assessment::Category, course_id: course.id
end

def allow_teaching_staff_manage_assessments
can :manage, Course::Assessment, assessment_course_hash
allow_manage_questions
Expand Down
2 changes: 2 additions & 0 deletions spec/models/course/assessment/assessment_ability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ def get_text_response_answer_for(submission)
# Course Tabs and Categories
it { is_expected.not_to be_able_to(:manage, tab) }
it { is_expected.not_to be_able_to(:manage, category) }
it { is_expected.to be_able_to(:read, tab) }
it { is_expected.to be_able_to(:read, category) }

# Course Assessments
it { is_expected.to be_able_to(:manage, unpublished_assessment) }
Expand Down