diff --git a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py index dbe8e9053a..7fdf99fe9b 100644 --- a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py +++ b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py @@ -14,7 +14,7 @@ from django.test.utils import override_settings from edxmako.shortcuts import render_to_response from courseware.tabs import get_course_tab_list -from courseware.tests.factories import UserFactory, StudentModuleFactory +from courseware.tests.factories import UserFactory, StudentModuleFactory, StaffFactory from courseware.tests.helpers import LoginEnrollmentTestCase from lms.djangoapps.instructor.views.gradebook_api import calculate_page_info @@ -100,9 +100,30 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT return len([tab for tab in tabs if tab.name == 'Instructor']) == 1 self.assertTrue(has_instructor_tab(self.instructor, self.course)) + + staff = StaffFactory(course_key=self.course.id) + self.assertTrue(has_instructor_tab(staff, self.course)) + student = UserFactory.create() self.assertFalse(has_instructor_tab(student, self.course)) + def test_student_admin_staff_instructor(self): + """ + Verify that staff users are not able to see course-wide options, while still + seeing individual learner options. + """ + # Original (instructor) user can see both specific grades, and course-wide grade adjustment tools + response = self.client.get(self.url) + self.assertIn('

Adjust all enrolled learners', response.content) + self.assertIn('

View a specific learner's grades and progress', response.content) + + # But staff user can only see specific grades + staff = StaffFactory(course_key=self.course.id) + self.client.login(username=staff.username, password="test") + response = self.client.get(self.url) + self.assertNotIn('

Adjust all enrolled learners', response.content) + self.assertIn('

View a specific learner's grades and progress', response.content) + def test_default_currency_in_the_html_response(self): """ Test that checks the default currency_symbol ($) in the response diff --git a/lms/templates/instructor/instructor_dashboard_2/student_admin.html b/lms/templates/instructor/instructor_dashboard_2/student_admin.html index d4f1e1123a..66534e50eb 100644 --- a/lms/templates/instructor/instructor_dashboard_2/student_admin.html +++ b/lms/templates/instructor/instructor_dashboard_2/student_admin.html @@ -1,6 +1,6 @@ <%page args="section_data" expression_filter="h"/> <%! from django.utils.translation import ugettext as _ %> -%if section_data['access']['instructor']: +%if section_data['access']['staff'] or section_data['access']['instructor']:
%if section_data['is_small_course']:

@@ -112,7 +112,7 @@

- %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'): + %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']:
${_("Rescore")}
%endif +%endif + +%if section_data['access']['instructor']: %if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):

${_("Adjust all enrolled learners' grades for a specific problem")}