Convert add_users_to_cohorts to require_course_permission

This commit is contained in:
Calen Pennington
2019-07-31 14:46:53 -04:00
parent a2ea80dbca
commit 04e5501324
2 changed files with 4 additions and 1 deletions

View File

@@ -6,8 +6,10 @@ from bridgekeeper import perms
from courseware.rules import HasAccessRule
ALLOW_STUDENT_TO_BYPASS_ENTRANCE_EXAM = 'instructor.allow_student_to_bypass_entrance_exam'
ASSIGN_TO_COHORTS = 'instructor.assign_to_cohorts'
VIEW_ISSUED_CERTIFICATES = 'instructor.view_issued_certificates'
perms[ALLOW_STUDENT_TO_BYPASS_ENTRANCE_EXAM] = HasAccessRule('staff')
perms[ASSIGN_TO_COHORTS] = HasAccessRule('staff')
perms[VIEW_ISSUED_CERTIFICATES] = HasAccessRule('staff')

View File

@@ -150,6 +150,7 @@ from .tools import (
from ..permissions import (
ALLOW_STUDENT_TO_BYPASS_ENTRANCE_EXAM,
ASSIGN_TO_COHORTS,
VIEW_ISSUED_CERTIFICATES,
)
@@ -1416,7 +1417,7 @@ def _cohorts_csv_validator(file_storage, file_to_validate):
@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_POST
@require_level('staff')
@require_course_permission(ASSIGN_TO_COHORTS)
@common_exceptions_400
def add_users_to_cohorts(request, course_id):
"""