This refactors instructor dashboard access to use Bridgekeeper permissions and allows the Data Researcher course/org role to access only the data downloads tab of the dashboard.

TNL-7176
This commit is contained in:
Dave St.Germain
2020-04-14 11:09:28 -04:00
parent 4e6248066a
commit 7336ea91fe
9 changed files with 172 additions and 149 deletions

View File

@@ -31,7 +31,7 @@ from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
from shoppingcart.models import CourseRegCodeItem, Order, PaidCourseRegistration
from student.models import CourseEnrollment
from student.roles import CourseFinanceAdminRole
from student.tests.factories import AdminFactory, CourseEnrollmentFactory
from student.tests.factories import AdminFactory, CourseAccessRoleFactory, CourseEnrollmentFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
@@ -118,6 +118,24 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
student = UserFactory.create()
self.assertFalse(has_instructor_tab(student, self.course))
researcher = UserFactory.create()
CourseAccessRoleFactory(
course_id=self.course.id,
user=researcher,
role='data_researcher',
org=self.course.id.org
)
self.assertTrue(has_instructor_tab(researcher, self.course))
org_researcher = UserFactory.create()
CourseAccessRoleFactory(
course_id=None,
user=org_researcher,
role='data_researcher',
org=self.course.id.org
)
self.assertTrue(has_instructor_tab(org_researcher, self.course))
@ddt.data(
("How to defeat the Road Runner", "2017", "001", "ACME"),
)