diff --git a/lms/djangoapps/instructor/tests/test_proctoring.py b/lms/djangoapps/instructor/tests/test_proctoring.py index e55c7954e0..7bac68a0ee 100644 --- a/lms/djangoapps/instructor/tests/test_proctoring.py +++ b/lms/djangoapps/instructor/tests/test_proctoring.py @@ -39,6 +39,34 @@ class TestProctoringDashboardViews(ModuleStoreTestCase): """ Test Pass Proctoring Tab is in the Instructor Dashboard """ + self.instructor.is_staff = True + self.instructor.save() + response = self.client.get(self.url) self.assertTrue(self.proctoring_link in response.content) self.assertTrue('Allowance Section' in response.content) + + def test_no_tab_non_global_staff(self): + """ + Test Pass Proctoring Tab is not in the Instructor Dashboard + for non global staff users + """ + self.instructor.is_staff = False + self.instructor.save() + + response = self.client.get(self.url) + self.assertFalse(self.proctoring_link in response.content) + self.assertFalse('Allowance Section' in response.content) + + @patch.dict(settings.FEATURES, {'ENABLE_PROCTORED_EXAMS': False}) + def test_no_tab_flag_unset(self): + """ + Test Pass Proctoring Tab is not in the Instructor Dashboard + if the feature flag 'ENABLE_PROCTORED_EXAMS' is unset. + """ + self.instructor.is_staff = True + self.instructor.save() + + response = self.client.get(self.url) + self.assertFalse(self.proctoring_link in response.content) + self.assertFalse('Allowance Section' in response.content) diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 237e689e8a..614d652144 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -142,7 +142,13 @@ def instructor_dashboard_2(request, course_id): sections.append(_section_e_commerce(course, access, paid_modes[0], is_white_label, is_white_label)) # Gate access to Proctoring tab - if settings.FEATURES.get('ENABLE_PROCTORED_EXAMS', False) and course.enable_proctored_exams: + # only global staff (user.is_staff) is allowed to see this tab + can_see_proctoring = ( + settings.FEATURES.get('ENABLE_PROCTORED_EXAMS', False) and + course.enable_proctored_exams and + request.user.is_staff + ) + if can_see_proctoring: sections.append(_section_proctoring(course, access)) # Certificates panel