diff --git a/common/djangoapps/student/roles.py b/common/djangoapps/student/roles.py index ff4f03d512..879d620bba 100644 --- a/common/djangoapps/student/roles.py +++ b/common/djangoapps/student/roles.py @@ -312,6 +312,14 @@ class CourseCcxCoachRole(CourseRole): super(CourseCcxCoachRole, self).__init__(self.ROLE, *args, **kwargs) +class CourseDataResearcherRole(CourseRole): + """A Data Researcher""" + ROLE = 'data_researcher' + + def __init__(self, *args, **kwargs): + super(CourseDataResearcherRole, self).__init__(self.ROLE, *args, **kwargs) + + class OrgStaffRole(OrgRole): """An organization staff member""" def __init__(self, *args, **kwargs): diff --git a/lms/djangoapps/instructor/access.py b/lms/djangoapps/instructor/access.py index 5da7ec1485..fbb431b401 100644 --- a/lms/djangoapps/instructor/access.py +++ b/lms/djangoapps/instructor/access.py @@ -14,7 +14,10 @@ import logging from lms.djangoapps.instructor.enrollment import enroll_email, get_email_params from openedx.core.djangoapps.django_comment_common.models import Role -from student.roles import CourseBetaTesterRole, CourseCcxCoachRole, CourseInstructorRole, CourseStaffRole +from student.roles import ( + CourseBetaTesterRole, CourseCcxCoachRole, CourseDataResearcherRole, + CourseInstructorRole, CourseStaffRole +) log = logging.getLogger(__name__) @@ -23,6 +26,7 @@ ROLES = { 'instructor': CourseInstructorRole, 'staff': CourseStaffRole, 'ccx_coach': CourseCcxCoachRole, + 'data_researcher': CourseDataResearcherRole, } diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index da9d780973..dffcacc649 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -56,7 +56,10 @@ from openedx.core.lib.url_utils import quote_slashes from openedx.core.lib.xblock_utils import wrap_xblock from shoppingcart.models import Coupon, CourseRegCodeItem, PaidCourseRegistration from student.models import CourseEnrollment -from student.roles import CourseFinanceAdminRole, CourseInstructorRole, CourseSalesAdminRole, CourseStaffRole +from student.roles import ( + CourseDataResearcherRole, CourseFinanceAdminRole, CourseInstructorRole, + CourseSalesAdminRole, CourseStaffRole +) from util.json_request import JsonResponse from xmodule.html_module import HtmlBlock from xmodule.modulestore.django import modulestore @@ -118,6 +121,7 @@ def instructor_dashboard_2(request, course_id): 'sales_admin': CourseSalesAdminRole(course_key).has_user(request.user), 'staff': bool(has_access(request.user, 'staff', course)), 'forum_admin': has_forum_access(request.user, course_key, FORUM_ROLE_ADMINISTRATOR), + 'data_researcher': CourseDataResearcherRole(course_key).has_user(request.user), } if not access['staff']: @@ -709,6 +713,8 @@ def _section_data_download(course, access): ), 'export_ora2_data_url': reverse('export_ora2_data', kwargs={'course_id': six.text_type(course_key)}), } + if not (access.get('data_researcher') or access.get('admin')): + section_data['is_hidden'] = True return section_data diff --git a/lms/templates/instructor/instructor_dashboard_2/membership.html b/lms/templates/instructor/instructor_dashboard_2/membership.html index 84ac8b7b1f..7945827b67 100644 --- a/lms/templates/instructor/instructor_dashboard_2/membership.html +++ b/lms/templates/instructor/instructor_dashboard_2/membership.html @@ -216,6 +216,17 @@ from openedx.core.djangolib.markup import HTML, Text data-modify-endpoint="${ section_data['update_forum_role_membership_url'] }" data-add-button-label="${_("Add Discussion Admin")}" > + +
+ %endif %if section_data['access']['instructor'] or section_data['access']['forum_admin']: