Added new role for course data researcher.

This commit is contained in:
Dave St.Germain
2019-11-15 10:41:36 -05:00
parent 41bc3106e9
commit 8b815b802b
4 changed files with 31 additions and 2 deletions

View File

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

View File

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

View File

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

View File

@@ -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")}"
></div>
<div class="auth-list-container"
data-rolename="data_researcher"
data-display-name="${_("Course Data Researcher")}"
data-info-text="
${_("Course Data Researchers can access the data download tab.")}"
data-list-endpoint="${ section_data['list_course_role_members_url'] }"
data-modify-endpoint="${ section_data['modify_access_url'] }"
data-add-button-label="${_("Add Course Data Researcher")}"
></div>
%endif
%if section_data['access']['instructor'] or section_data['access']['forum_admin']: