Merge pull request #28445 from edx/mohtamba/add-proctor-card-to-course-authoring

Add proctored exam settings card to the pages and resources webpage
This commit is contained in:
mohtamba
2021-08-12 15:39:01 -04:00
committed by GitHub
2 changed files with 48 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
"""Course app config for courseware apps."""
from cms.djangoapps.contentstore.utils import get_proctored_exam_settings_url
from typing import Dict, Optional
from django import urls
@@ -161,3 +162,49 @@ class CalculatorCourseApp(CourseApp):
# There is nothing to configure for calculator yet.
"configure": False,
}
class ProctoringCourseApp(CourseApp):
"""
Course App config for proctoring app.
"""
app_id = "proctoring"
name = _("Proctoring")
description = _("Maintain exam integrity by enabling a proctoring solution for your course")
@classmethod
def is_available(cls, course_key: CourseKey) -> bool:
"""
Proctoring is available for all courses.
"""
return settings.FEATURES.get("ENABLE_SPECIAL_EXAMS", False)
@classmethod
def is_enabled(cls, course_key: CourseKey) -> bool:
"""
Get proctoring enabled status from course overview model.
"""
return CourseOverview.get_from_id(course_key).enable_proctored_exams
@classmethod
def set_enabled(cls, course_key: CourseKey, enabled: bool, user: 'User') -> bool:
"""
Don't allow proctored exam settings to be enabled from the card
"""
raise ValueError("Teams cannot be enabled/disabled via this API.")
@classmethod
def get_allowed_operations(cls, course_key: CourseKey, user: Optional[User] = None) -> Dict[str, bool]:
"""
Get allowed operations for proctoring app.
"""
return {
"enable": False,
# There is nothing to configure for proctored exams yet.
"configure": False,
}
@staticmethod
def legacy_link(course_key: CourseKey):
return get_proctored_exam_settings_url(course_key)

View File

@@ -42,6 +42,7 @@ setup(
"calculator = lms.djangoapps.courseware.plugins:CalculatorCourseApp",
"discussion = openedx.core.djangoapps.discussions.plugins:DiscussionCourseApp",
"edxnotes = lms.djangoapps.edxnotes.plugins:EdxNotesCourseApp",
"proctoring = lms.djangoapps.courseware.plugins:ProctoringCourseApp",
"progress = lms.djangoapps.courseware.plugins:ProgressCourseApp",
"teams = lms.djangoapps.teams.plugins:TeamsCourseApp",
"textbooks = lms.djangoapps.courseware.plugins:TextbooksCourseApp",