From d0da23058d9d0cd247085d81c1339feef3ed1f05 Mon Sep 17 00:00:00 2001 From: Bianca Severino Date: Mon, 9 Aug 2021 10:38:27 -0400 Subject: [PATCH] chore: set runtime service for name affirmation If special exams are enabled, set a runtime service for Name Affirmation in order to enable it for use in proctored exam attempts. --- lms/envs/common.py | 1 + .../features/name_affirmation_api/README.rst | 6 +++++ .../features/name_affirmation_api/__init__.py | 0 openedx/features/name_affirmation_api/apps.py | 23 +++++++++++++++++++ requirements/edx/base.txt | 2 +- requirements/edx/development.txt | 2 +- requirements/edx/testing.txt | 2 +- 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 openedx/features/name_affirmation_api/README.rst create mode 100644 openedx/features/name_affirmation_api/__init__.py create mode 100644 openedx/features/name_affirmation_api/apps.py diff --git a/lms/envs/common.py b/lms/envs/common.py index f95c9b135f..d5b3ac2b1a 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -3098,6 +3098,7 @@ INSTALLED_APPS = [ 'openedx.features.content_type_gating', 'openedx.features.discounts', 'openedx.features.effort_estimation', + 'openedx.features.name_affirmation_api.apps.NameAffirmationApiConfig', 'lms.djangoapps.experiments', diff --git a/openedx/features/name_affirmation_api/README.rst b/openedx/features/name_affirmation_api/README.rst new file mode 100644 index 0000000000..8cb928f47f --- /dev/null +++ b/openedx/features/name_affirmation_api/README.rst @@ -0,0 +1,6 @@ +Name Affirmation API +-------------------- + +This directory contains a passthrough for the edx-name-affirmation plugin, +in order to enable support in other plugins/packages such as edx-proctoring. +See here: `https://github.com/edx/edx-name-affirmation`_. diff --git a/openedx/features/name_affirmation_api/__init__.py b/openedx/features/name_affirmation_api/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openedx/features/name_affirmation_api/apps.py b/openedx/features/name_affirmation_api/apps.py new file mode 100644 index 0000000000..35cdb150a7 --- /dev/null +++ b/openedx/features/name_affirmation_api/apps.py @@ -0,0 +1,23 @@ +""" +Name Affirmation API App Configuration +""" + + +from django.apps import AppConfig +from django.conf import settings +from edx_proctoring.runtime import set_runtime_service + + +class NameAffirmationApiConfig(AppConfig): + """ + Application Configuration for Misc Services. + """ + name = 'openedx.features.name_affirmation_api' + + def ready(self): + """ + Connect services. + """ + if settings.FEATURES.get('ENABLE_SPECIAL_EXAMS'): + from edx_name_affirmation.services import NameAffirmationService + set_runtime_service('name_affirmation', NameAffirmationService()) diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 1f5fdf5927..5882167b15 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -445,7 +445,7 @@ edx-i18n-tools==0.7.0 # via ora2 edx-milestones==0.3.2 # via -r requirements/edx/base.in -edx-name-affirmation==0.3.1 +edx-name-affirmation==0.4.0 # via -r requirements/edx/base.in edx-opaque-keys[django]==2.2.2 # via diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 4a70bf4559..044e7c5907 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -542,7 +542,7 @@ edx-lint==5.0.0 # via -r requirements/edx/testing.txt edx-milestones==0.3.2 # via -r requirements/edx/testing.txt -edx-name-affirmation==0.3.1 +edx-name-affirmation==0.4.0 # via -r requirements/edx/testing.txt edx-opaque-keys[django]==2.2.2 # via diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 6d47755586..c84a831e03 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -526,7 +526,7 @@ edx-lint==5.0.0 # via -r requirements/edx/testing.in edx-milestones==0.3.2 # via -r requirements/edx/base.txt -edx-name-affirmation==0.3.1 +edx-name-affirmation==0.4.0 # via -r requirements/edx/base.txt edx-opaque-keys[django]==2.2.2 # via