From 6d7be8d539e2ab3c7ffc072b3e88e79a3de3090b Mon Sep 17 00:00:00 2001 From: Phillmont Muktar <51525686+purfectliterature@users.noreply.github.com> Date: Fri, 11 Aug 2023 20:32:11 +0800 Subject: [PATCH] fix(assessments): TAs cannot access tabs, categories --- app/models/course/assessment/assessment_ability.rb | 6 ++++++ spec/models/course/assessment/assessment_ability_spec.rb | 2 ++ 2 files changed, 8 insertions(+) diff --git a/app/models/course/assessment/assessment_ability.rb b/app/models/course/assessment/assessment_ability.rb index 9d0b12b1354..af3dce7c299 100644 --- a/app/models/course/assessment/assessment_ability.rb +++ b/app/models/course/assessment/assessment_ability.rb @@ -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 @@ -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 diff --git a/spec/models/course/assessment/assessment_ability_spec.rb b/spec/models/course/assessment/assessment_ability_spec.rb index 49a801d7ce3..12d8b909256 100644 --- a/spec/models/course/assessment/assessment_ability_spec.rb +++ b/spec/models/course/assessment/assessment_ability_spec.rb @@ -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) }