Merge pull request #9331 from edx/cdodge/only-global-staff-see-proctoring

only let global staff (is_staff) see the proctoring tab
This commit is contained in:
chrisndodge
2015-08-17 11:40:52 -04:00
2 changed files with 35 additions and 1 deletions

View File

@@ -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)

View File

@@ -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