edx-proctoring 6.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edx_proctoring/__init__.py +6 -0
- edx_proctoring/admin.py +502 -0
- edx_proctoring/api.py +3269 -0
- edx_proctoring/apps.py +162 -0
- edx_proctoring/backends/LICENSE.txt +202 -0
- edx_proctoring/backends/README.txt +1 -0
- edx_proctoring/backends/__init__.py +20 -0
- edx_proctoring/backends/backend.py +162 -0
- edx_proctoring/backends/mock.py +105 -0
- edx_proctoring/backends/null.py +61 -0
- edx_proctoring/backends/rest.py +422 -0
- edx_proctoring/backends/software_secure.py +423 -0
- edx_proctoring/backends/tests/__init__.py +3 -0
- edx_proctoring/backends/tests/test_backend.py +363 -0
- edx_proctoring/backends/tests/test_rest.py +624 -0
- edx_proctoring/backends/tests/test_review_payload.py +102 -0
- edx_proctoring/backends/tests/test_software_secure.py +628 -0
- edx_proctoring/callbacks.py +66 -0
- edx_proctoring/constants.py +83 -0
- edx_proctoring/decorators.py +3 -0
- edx_proctoring/exceptions.py +188 -0
- edx_proctoring/handlers.py +229 -0
- edx_proctoring/instructor_dashboard_exam_urls.py +19 -0
- edx_proctoring/locale/ar/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/ar/LC_MESSAGES/django.po +1445 -0
- edx_proctoring/locale/ar/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/ar/LC_MESSAGES/djangojs.po +1443 -0
- edx_proctoring/locale/ca/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/ca/LC_MESSAGES/django.po +1464 -0
- edx_proctoring/locale/ca/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/ca/LC_MESSAGES/djangojs.po +1463 -0
- edx_proctoring/locale/config.yaml +73 -0
- edx_proctoring/locale/cs/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/cs/LC_MESSAGES/django.po +1632 -0
- edx_proctoring/locale/cs/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/cs/LC_MESSAGES/djangojs.po +1634 -0
- edx_proctoring/locale/de_DE/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/de_DE/LC_MESSAGES/django.po +1461 -0
- edx_proctoring/locale/de_DE/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/de_DE/LC_MESSAGES/djangojs.po +1461 -0
- edx_proctoring/locale/el/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/el/LC_MESSAGES/django.po +1389 -0
- edx_proctoring/locale/el/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/el/LC_MESSAGES/djangojs.po +1387 -0
- edx_proctoring/locale/en/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/en/LC_MESSAGES/django.po +1476 -0
- edx_proctoring/locale/en/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/en/LC_MESSAGES/djangojs.po +264 -0
- edx_proctoring/locale/eo/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/eo/LC_MESSAGES/django.po +1880 -0
- edx_proctoring/locale/eo/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/eo/LC_MESSAGES/djangojs.po +304 -0
- edx_proctoring/locale/es_419/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/es_419/LC_MESSAGES/django.po +1783 -0
- edx_proctoring/locale/es_419/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/es_419/LC_MESSAGES/djangojs.po +1785 -0
- edx_proctoring/locale/es_AR/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/es_AR/LC_MESSAGES/django.po +1654 -0
- edx_proctoring/locale/es_AR/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/es_AR/LC_MESSAGES/djangojs.po +1655 -0
- edx_proctoring/locale/es_ES/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/es_ES/LC_MESSAGES/django.po +1655 -0
- edx_proctoring/locale/es_ES/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/es_ES/LC_MESSAGES/djangojs.po +1652 -0
- edx_proctoring/locale/eu_ES/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/eu_ES/LC_MESSAGES/django.po +1378 -0
- edx_proctoring/locale/eu_ES/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/eu_ES/LC_MESSAGES/djangojs.po +1378 -0
- edx_proctoring/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/fa_IR/LC_MESSAGES/django.po +1666 -0
- edx_proctoring/locale/fa_IR/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/fa_IR/LC_MESSAGES/djangojs.po +1665 -0
- edx_proctoring/locale/fr/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/fr/LC_MESSAGES/django.po +1805 -0
- edx_proctoring/locale/fr/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/fr/LC_MESSAGES/djangojs.po +1802 -0
- edx_proctoring/locale/fr_CA/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/fr_CA/LC_MESSAGES/django.po +1790 -0
- edx_proctoring/locale/fr_CA/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/fr_CA/LC_MESSAGES/djangojs.po +1793 -0
- edx_proctoring/locale/he/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/he/LC_MESSAGES/django.po +1444 -0
- edx_proctoring/locale/he/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/he/LC_MESSAGES/djangojs.po +1443 -0
- edx_proctoring/locale/id/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/id/LC_MESSAGES/django.po +1390 -0
- edx_proctoring/locale/id/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/id/LC_MESSAGES/djangojs.po +1389 -0
- edx_proctoring/locale/it_IT/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/it_IT/LC_MESSAGES/django.po +1715 -0
- edx_proctoring/locale/it_IT/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/it_IT/LC_MESSAGES/djangojs.po +1715 -0
- edx_proctoring/locale/ja_JP/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/ja_JP/LC_MESSAGES/djangojs.po +1387 -0
- edx_proctoring/locale/ka/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/ka/LC_MESSAGES/django.po +1380 -0
- edx_proctoring/locale/ka/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/ka/LC_MESSAGES/djangojs.po +1380 -0
- edx_proctoring/locale/lv/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/lv/LC_MESSAGES/django.po +1377 -0
- edx_proctoring/locale/lv/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/lv/LC_MESSAGES/djangojs.po +1377 -0
- edx_proctoring/locale/mn/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/mn/LC_MESSAGES/django.po +1434 -0
- edx_proctoring/locale/mn/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/mn/LC_MESSAGES/djangojs.po +1379 -0
- edx_proctoring/locale/nb/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/nb/LC_MESSAGES/django.po +1393 -0
- edx_proctoring/locale/nb/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/nb/LC_MESSAGES/djangojs.po +1393 -0
- edx_proctoring/locale/pl/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/pl/LC_MESSAGES/django.po +1386 -0
- edx_proctoring/locale/pl/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/pl/LC_MESSAGES/djangojs.po +1386 -0
- edx_proctoring/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/pt_PT/LC_MESSAGES/django.po +1793 -0
- edx_proctoring/locale/pt_PT/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/pt_PT/LC_MESSAGES/djangojs.po +1810 -0
- edx_proctoring/locale/ro/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/ro/LC_MESSAGES/django.po +1382 -0
- edx_proctoring/locale/ro/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/ro/LC_MESSAGES/djangojs.po +1382 -0
- edx_proctoring/locale/ru/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/ru/LC_MESSAGES/django.po +1456 -0
- edx_proctoring/locale/ru/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/ru/LC_MESSAGES/djangojs.po +1459 -0
- edx_proctoring/locale/sw_KE/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/sw_KE/LC_MESSAGES/django.po +1462 -0
- edx_proctoring/locale/sw_KE/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/sw_KE/LC_MESSAGES/djangojs.po +1464 -0
- edx_proctoring/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/tr_TR/LC_MESSAGES/django.po +1527 -0
- edx_proctoring/locale/tr_TR/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/tr_TR/LC_MESSAGES/djangojs.po +1527 -0
- edx_proctoring/locale/uk/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/uk/LC_MESSAGES/django.po +1443 -0
- edx_proctoring/locale/uk/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/uk/LC_MESSAGES/djangojs.po +1443 -0
- edx_proctoring/locale/zh_CN/LC_MESSAGES/django.mo +0 -0
- edx_proctoring/locale/zh_CN/LC_MESSAGES/django.po +1468 -0
- edx_proctoring/locale/zh_CN/LC_MESSAGES/djangojs.mo +0 -0
- edx_proctoring/locale/zh_CN/LC_MESSAGES/djangojs.po +1469 -0
- edx_proctoring/management/__init__.py +3 -0
- edx_proctoring/management/commands/__init__.py +3 -0
- edx_proctoring/management/commands/reset_attempts.py +87 -0
- edx_proctoring/management/commands/set_attempt_status.py +52 -0
- edx_proctoring/management/commands/set_is_attempt_active.py +104 -0
- edx_proctoring/management/commands/tests/__init__.py +3 -0
- edx_proctoring/management/commands/tests/test_reset_attempts.py +153 -0
- edx_proctoring/management/commands/tests/test_set_attempt_status.py +85 -0
- edx_proctoring/management/commands/tests/test_set_is_attempt_active.py +85 -0
- edx_proctoring/management/commands/tests/test_update_attempt_status_from_review.py +113 -0
- edx_proctoring/management/commands/tests/test_update_attempts_for_exam.py +62 -0
- edx_proctoring/management/commands/update_attempt_status_from_review.py +81 -0
- edx_proctoring/management/commands/update_attempts_for_exam.py +78 -0
- edx_proctoring/migrations/0001_initial.py +227 -0
- edx_proctoring/migrations/0002_proctoredexamstudentattempt_is_status_acknowledged.py +18 -0
- edx_proctoring/migrations/0003_auto_20160101_0525.py +24 -0
- edx_proctoring/migrations/0004_auto_20160201_0523.py +19 -0
- edx_proctoring/migrations/0005_proctoredexam_hide_after_due.py +19 -0
- edx_proctoring/migrations/0006_allowed_time_limit_mins.py +24 -0
- edx_proctoring/migrations/0007_proctoredexam_backend.py +20 -0
- edx_proctoring/migrations/0008_auto_20181116_1551.py +32 -0
- edx_proctoring/migrations/0009_proctoredexamreviewpolicy_remove_rules.py +23 -0
- edx_proctoring/migrations/0010_update_backend.py +32 -0
- edx_proctoring/migrations/0011_allow_multiple_attempts.py +17 -0
- edx_proctoring/migrations/0012_proctoredexamstudentattempt_time_remaining_seconds.py +18 -0
- edx_proctoring/migrations/0013_proctoredexamsoftwaresecurereview_is_active_attempt.py +23 -0
- edx_proctoring/migrations/0014_add_is_resumable_to_proctoredexamstudentattempt.py +23 -0
- edx_proctoring/migrations/0015_rm_proctoredexamstudentattempt_ips.py +29 -0
- edx_proctoring/migrations/0016_nullable_proctoredexamstudentattempt_name.py +23 -0
- edx_proctoring/migrations/0017_rm_proctoredexamstudentattempt_name.py +21 -0
- edx_proctoring/migrations/0018_historicalproctoredexamstudentattempt.py +53 -0
- edx_proctoring/migrations/0019_proctoredexamsoftwaresecurereview_encrypted_video_url.py +18 -0
- edx_proctoring/migrations/0020_auto_20211028_1915.py +23 -0
- edx_proctoring/migrations/0021_auto_20211029_1353.py +26 -0
- edx_proctoring/migrations/0022_proctoredexamstudentattempt_add_readytoresume_resumed.py +33 -0
- edx_proctoring/migrations/0023_historicalproctoredexam.py +50 -0
- edx_proctoring/migrations/0024_delete_proctoredexamstudentattempthistory.py +16 -0
- edx_proctoring/migrations/0025_auto_20230727_2112.py +21 -0
- edx_proctoring/migrations/__init__.py +0 -0
- edx_proctoring/models.py +844 -0
- edx_proctoring/rules.py +15 -0
- edx_proctoring/runtime.py +21 -0
- edx_proctoring/scripts/obscure_user.py +108 -0
- edx_proctoring/serializers.py +147 -0
- edx_proctoring/services.py +43 -0
- edx_proctoring/settings/__init__.py +0 -0
- edx_proctoring/settings/common.py +50 -0
- edx_proctoring/settings/production.py +13 -0
- edx_proctoring/settings/test.py +11 -0
- edx_proctoring/signals.py +5 -0
- edx_proctoring/static/index.js +41 -0
- edx_proctoring/static/proctoring/clippy.swf +0 -0
- edx_proctoring/static/proctoring/close-modal-hover.png +0 -0
- edx_proctoring/static/proctoring/close-modal.png +0 -0
- edx_proctoring/static/proctoring/js/collections/proctored_exam_allowance_collection.js +15 -0
- edx_proctoring/static/proctoring/js/collections/proctored_exam_attempt_grouped_collection.js +15 -0
- edx_proctoring/static/proctoring/js/collections/proctored_exam_collection.js +16 -0
- edx_proctoring/static/proctoring/js/collections/proctored_exam_onboarding_collection.js +13 -0
- edx_proctoring/static/proctoring/js/dropdown.js +97 -0
- edx_proctoring/static/proctoring/js/exam_action_handler.js +252 -0
- edx_proctoring/static/proctoring/js/models/learner_onboarding_model.js +9 -0
- edx_proctoring/static/proctoring/js/models/proctored_exam_allowance_model.js +15 -0
- edx_proctoring/static/proctoring/js/models/proctored_exam_attempt_model.js +15 -0
- edx_proctoring/static/proctoring/js/models/proctored_exam_bulk_allowance_model.js +15 -0
- edx_proctoring/static/proctoring/js/models/proctored_exam_model.js +56 -0
- edx_proctoring/static/proctoring/js/proctored_app.js +16 -0
- edx_proctoring/static/proctoring/js/vendor/backbone.js +1608 -0
- edx_proctoring/static/proctoring/js/vendor/date.js +145 -0
- edx_proctoring/static/proctoring/js/vendor/i18n.js +10 -0
- edx_proctoring/static/proctoring/js/vendor/jquery.js +4 -0
- edx_proctoring/static/proctoring/js/vendor/underscore.js +1416 -0
- edx_proctoring/static/proctoring/js/views/Backbone.ModalDialog.js +338 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_add_bulk_allowance_view.js +300 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_allowance_view.js +204 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_attempt_view.js +307 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_edit_allowance_view.js +165 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_info.js +232 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_instructor_launch.js +41 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_onboarding_view.js +288 -0
- edx_proctoring/static/proctoring/js/views/proctored_exam_view.js +267 -0
- edx_proctoring/static/proctoring/templates/add-new-bulk-allowance.underscore +105 -0
- edx_proctoring/static/proctoring/templates/course_grouped_allowances.underscore +70 -0
- edx_proctoring/static/proctoring/templates/dashboard.underscore +3 -0
- edx_proctoring/static/proctoring/templates/edit-allowance.underscore +52 -0
- edx_proctoring/static/proctoring/templates/proctored-exam-info.underscore +46 -0
- edx_proctoring/static/proctoring/templates/student-onboarding-status.underscore +153 -0
- edx_proctoring/static/proctoring/templates/student-proctored-exam-attempts-grouped.underscore +287 -0
- edx_proctoring/statuses.py +330 -0
- edx_proctoring/templates/common/waiting_banner.html +12 -0
- edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html +28 -0
- edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html +20 -0
- edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html +33 -0
- edx_proctoring/templates/onboarding_exam/entrance.html +65 -0
- edx_proctoring/templates/onboarding_exam/error.html +18 -0
- edx_proctoring/templates/onboarding_exam/ready_to_submit.html +10 -0
- edx_proctoring/templates/onboarding_exam/rejected.html +33 -0
- edx_proctoring/templates/onboarding_exam/submitted.html +60 -0
- edx_proctoring/templates/onboarding_exam/verified.html +23 -0
- edx_proctoring/templates/practice_exam/entrance.html +90 -0
- edx_proctoring/templates/practice_exam/error.html +42 -0
- edx_proctoring/templates/practice_exam/submitted.html +31 -0
- edx_proctoring/templates/proctored_exam/confirm-decline.html +55 -0
- edx_proctoring/templates/proctored_exam/entrance.html +29 -0
- edx_proctoring/templates/proctored_exam/error.html +26 -0
- edx_proctoring/templates/proctored_exam/error_modal.html +26 -0
- edx_proctoring/templates/proctored_exam/error_wrong_browser.html +32 -0
- edx_proctoring/templates/proctored_exam/expired.html +13 -0
- edx_proctoring/templates/proctored_exam/failed-prerequisites.html +46 -0
- edx_proctoring/templates/proctored_exam/footer.html +80 -0
- edx_proctoring/templates/proctored_exam/inactive_account.html +38 -0
- edx_proctoring/templates/proctored_exam/instructions.html +227 -0
- edx_proctoring/templates/proctored_exam/onboarding_error.html +45 -0
- edx_proctoring/templates/proctored_exam/pending-prerequisites.html +40 -0
- edx_proctoring/templates/proctored_exam/proctoring_launch_callback.html +183 -0
- edx_proctoring/templates/proctored_exam/proctoring_opt_out_button.html +8 -0
- edx_proctoring/templates/proctored_exam/ready_to_resume.html +33 -0
- edx_proctoring/templates/proctored_exam/ready_to_start.html +70 -0
- edx_proctoring/templates/proctored_exam/ready_to_submit.html +39 -0
- edx_proctoring/templates/proctored_exam/rejected.html +30 -0
- edx_proctoring/templates/proctored_exam/submitted.html +24 -0
- edx_proctoring/templates/proctored_exam/verified.html +19 -0
- edx_proctoring/templates/proctored_exam/visit_exam_content.html +38 -0
- edx_proctoring/templates/timed_exam/entrance.html +79 -0
- edx_proctoring/templates/timed_exam/expired.html +13 -0
- edx_proctoring/templates/timed_exam/footer.html +10 -0
- edx_proctoring/templates/timed_exam/ready_to_submit.html +56 -0
- edx_proctoring/templates/timed_exam/submitted.html +32 -0
- edx_proctoring/tests/__init__.py +56 -0
- edx_proctoring/tests/test_api.py +3878 -0
- edx_proctoring/tests/test_email.py +325 -0
- edx_proctoring/tests/test_handlers.py +56 -0
- edx_proctoring/tests/test_mfe_views.py +579 -0
- edx_proctoring/tests/test_models.py +483 -0
- edx_proctoring/tests/test_reviews.py +844 -0
- edx_proctoring/tests/test_serializer.py +34 -0
- edx_proctoring/tests/test_services.py +429 -0
- edx_proctoring/tests/test_student_view.py +1676 -0
- edx_proctoring/tests/test_utils/factories.py +35 -0
- edx_proctoring/tests/test_utils/test_utils.py +207 -0
- edx_proctoring/tests/test_utils/utils.py +402 -0
- edx_proctoring/tests/test_views.py +6501 -0
- edx_proctoring/tests/test_workerconfig.py +96 -0
- edx_proctoring/urls.py +149 -0
- edx_proctoring/utils.py +488 -0
- edx_proctoring/views.py +2333 -0
- edx_proctoring-6.2.0.dist-info/METADATA +152 -0
- edx_proctoring-6.2.0.dist-info/RECORD +293 -0
- edx_proctoring-6.2.0.dist-info/WHEEL +5 -0
- edx_proctoring-6.2.0.dist-info/entry_points.txt +11 -0
- edx_proctoring-6.2.0.dist-info/licenses/LICENSE.txt +674 -0
- edx_proctoring-6.2.0.dist-info/top_level.txt +1 -0
edx_proctoring/apps.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
edx_proctoring Django application initialization.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import os.path
|
|
9
|
+
import warnings
|
|
10
|
+
|
|
11
|
+
from stevedore.extension import ExtensionManager
|
|
12
|
+
|
|
13
|
+
from django.apps import AppConfig
|
|
14
|
+
from django.conf import settings
|
|
15
|
+
from django.core.exceptions import ImproperlyConfigured
|
|
16
|
+
|
|
17
|
+
BACKEND_CONFIGURATION_ALLOW_LIST = [
|
|
18
|
+
'base_url',
|
|
19
|
+
'client_id',
|
|
20
|
+
'client_secret',
|
|
21
|
+
'crypto_key',
|
|
22
|
+
'default_rules',
|
|
23
|
+
'exam_register_endpoint',
|
|
24
|
+
'exam_sponsor',
|
|
25
|
+
'has_dashboard',
|
|
26
|
+
'help_center_article_url',
|
|
27
|
+
'integration_specific_email',
|
|
28
|
+
'learner_notification_from_email',
|
|
29
|
+
'needs_oauth',
|
|
30
|
+
'organization',
|
|
31
|
+
'passing_statuses',
|
|
32
|
+
'ping_interval',
|
|
33
|
+
'secret_key',
|
|
34
|
+
'secret_key_id',
|
|
35
|
+
'send_email',
|
|
36
|
+
'software_download_url',
|
|
37
|
+
'supports_onboarding',
|
|
38
|
+
'tech_support_email',
|
|
39
|
+
'tech_support_phone',
|
|
40
|
+
'timeout',
|
|
41
|
+
'token_expiration_time',
|
|
42
|
+
'verbose_name',
|
|
43
|
+
'video_review_aes_key',
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def make_worker_config(backends, out='/tmp/workers.json'):
|
|
48
|
+
"""
|
|
49
|
+
Generates a config json file used for edx-platform's webpack.common.config.js
|
|
50
|
+
"""
|
|
51
|
+
if not getattr(settings, 'NODE_MODULES_ROOT', None):
|
|
52
|
+
return False
|
|
53
|
+
config = {}
|
|
54
|
+
for backend in backends:
|
|
55
|
+
try:
|
|
56
|
+
package = backend.npm_module
|
|
57
|
+
package_file = os.path.join(settings.NODE_MODULES_ROOT, package, 'package.json')
|
|
58
|
+
with open(package_file, 'r', encoding='utf-8') as package_fp:
|
|
59
|
+
package_json = json.load(package_fp)
|
|
60
|
+
main_file = package_json['main']
|
|
61
|
+
config[package] = ['babel-polyfill', os.path.join(settings.NODE_MODULES_ROOT, package, main_file)]
|
|
62
|
+
except AttributeError:
|
|
63
|
+
# no npm module defined
|
|
64
|
+
continue
|
|
65
|
+
except IOError:
|
|
66
|
+
warnings.warn(f'Proctoring backend {backend.__class__} defined an npm module,'
|
|
67
|
+
f'but it is not installed at {package_file!r}')
|
|
68
|
+
except KeyError:
|
|
69
|
+
warnings.warn(f'{package_file!r} does not contain a `main` entry')
|
|
70
|
+
if config:
|
|
71
|
+
try:
|
|
72
|
+
with open(out, 'wb+') as outfp:
|
|
73
|
+
outfp.write(json.dumps(config).encode('utf-8'))
|
|
74
|
+
except IOError:
|
|
75
|
+
warnings.warn(f"Could not write worker config to {out}")
|
|
76
|
+
else:
|
|
77
|
+
# make sure that this file is group writable, because it may be written by different users
|
|
78
|
+
os.chmod(out, 0o664)
|
|
79
|
+
return True
|
|
80
|
+
return False
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class EdxProctoringConfig(AppConfig):
|
|
84
|
+
"""
|
|
85
|
+
Configuration for the edx_proctoring Django application.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
name = 'edx_proctoring'
|
|
89
|
+
plugin_app = {
|
|
90
|
+
'url_config': {
|
|
91
|
+
'lms.djangoapp': {
|
|
92
|
+
'namespace': 'edx_proctoring',
|
|
93
|
+
'regex': '^api/',
|
|
94
|
+
'relative_path': 'urls',
|
|
95
|
+
},
|
|
96
|
+
'cms.djangoapp': {
|
|
97
|
+
'namespace': 'edx_proctoring',
|
|
98
|
+
'regex': '^api/',
|
|
99
|
+
'relative_path': 'instructor_dashboard_exam_urls',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
'settings_config': {
|
|
103
|
+
'lms.djangoapp': {
|
|
104
|
+
'common': {'relative_path': 'settings.common'},
|
|
105
|
+
'production': {'relative_path': 'settings.production'},
|
|
106
|
+
},
|
|
107
|
+
'cms.djangoapp': {
|
|
108
|
+
'common': {'relative_path': 'settings.common'},
|
|
109
|
+
'production': {'relative_path': 'settings.production'},
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
def get_backend_choices(self):
|
|
116
|
+
"""
|
|
117
|
+
Returns an iterator of available backends:
|
|
118
|
+
backend_name, verbose name
|
|
119
|
+
"""
|
|
120
|
+
for name, backend in self.backends.items():
|
|
121
|
+
yield name, getattr(backend, 'verbose_name', 'Unknown')
|
|
122
|
+
|
|
123
|
+
def get_backend(self, name=None):
|
|
124
|
+
"""
|
|
125
|
+
Returns an instance of the proctoring backend.
|
|
126
|
+
|
|
127
|
+
:param str name: Name of entrypoint in openedx.proctoring
|
|
128
|
+
:param dict options: Keyword arguments to use when instantiating the backend
|
|
129
|
+
"""
|
|
130
|
+
if name is None:
|
|
131
|
+
try:
|
|
132
|
+
name = settings.PROCTORING_BACKENDS['DEFAULT']
|
|
133
|
+
except (KeyError, AttributeError) as exc:
|
|
134
|
+
raise ImproperlyConfigured("No default proctoring backend set in settings.PROCTORING_BACKENDS") \
|
|
135
|
+
from exc
|
|
136
|
+
try:
|
|
137
|
+
return self.backends[name]
|
|
138
|
+
except KeyError as error:
|
|
139
|
+
raise NotImplementedError(f"No proctoring backend configured for '{name}'. "
|
|
140
|
+
f"Available: {list(self.backends)}") from error
|
|
141
|
+
|
|
142
|
+
def ready(self):
|
|
143
|
+
"""
|
|
144
|
+
Loads the available proctoring backends
|
|
145
|
+
"""
|
|
146
|
+
# pylint: disable=unused-import
|
|
147
|
+
# pylint: disable=import-outside-toplevel
|
|
148
|
+
from edx_proctoring import handlers, signals
|
|
149
|
+
config = settings.PROCTORING_BACKENDS
|
|
150
|
+
|
|
151
|
+
self.backends = {} # pylint: disable=W0201
|
|
152
|
+
for extension in ExtensionManager(namespace='openedx.proctoring'):
|
|
153
|
+
name = extension.name
|
|
154
|
+
try:
|
|
155
|
+
options = {
|
|
156
|
+
key: val for (key, val) in config[name].items()
|
|
157
|
+
if key in BACKEND_CONFIGURATION_ALLOW_LIST
|
|
158
|
+
}
|
|
159
|
+
self.backends[name] = extension.plugin(**options)
|
|
160
|
+
except KeyError:
|
|
161
|
+
pass
|
|
162
|
+
make_worker_config(list(self.backends.values()), out=os.path.join(settings.ENV_ROOT, 'workers.json'))
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The code in this directory is licensed under a license different from the rest of the edx-proctoring repository. These modules are licensed under Apache 2.0. See LICENSE.txt.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
All supporting Proctoring backends
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from django.apps import apps
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_backend_provider(exam=None, name=None):
|
|
9
|
+
"""
|
|
10
|
+
Returns an instance of the configured backend provider
|
|
11
|
+
Passing in an exam will return the backend for that exam
|
|
12
|
+
Passing in a name will return the named backend
|
|
13
|
+
"""
|
|
14
|
+
if exam:
|
|
15
|
+
if 'is_proctored' in exam and not exam['is_proctored']:
|
|
16
|
+
# timed exams don't have a backend
|
|
17
|
+
return None
|
|
18
|
+
if exam['backend']:
|
|
19
|
+
name = exam['backend']
|
|
20
|
+
return apps.get_app_config('edx_proctoring').get_backend(name=name)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Defines the abstract base class that all backends should derive from
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import abc
|
|
6
|
+
|
|
7
|
+
from edx_proctoring import constants
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProctoringBackendProvider(metaclass=abc.ABCMeta):
|
|
11
|
+
"""
|
|
12
|
+
The base abstract class for all proctoring service providers
|
|
13
|
+
"""
|
|
14
|
+
verbose_name = 'Unknown'
|
|
15
|
+
ping_interval = constants.DEFAULT_DESKTOP_APPLICATION_PING_INTERVAL_SECONDS
|
|
16
|
+
tech_support_email = ''
|
|
17
|
+
learner_notification_from_email = ''
|
|
18
|
+
tech_support_phone = ''
|
|
19
|
+
# whether this backend supports an instructor review/configuration dashboard
|
|
20
|
+
has_dashboard = False
|
|
21
|
+
# whether practice exams map to "onboarding" exams for this backend
|
|
22
|
+
supports_onboarding = False
|
|
23
|
+
help_center_article_url = ''
|
|
24
|
+
|
|
25
|
+
def __init__(self, **kwargs):
|
|
26
|
+
for key, value in kwargs.items():
|
|
27
|
+
setattr(self, key, value)
|
|
28
|
+
|
|
29
|
+
@abc.abstractmethod
|
|
30
|
+
def register_exam_attempt(self, exam, context):
|
|
31
|
+
"""
|
|
32
|
+
Called when the exam attempt has been created but not started
|
|
33
|
+
"""
|
|
34
|
+
raise NotImplementedError()
|
|
35
|
+
|
|
36
|
+
@abc.abstractmethod
|
|
37
|
+
def start_exam_attempt(self, exam, attempt):
|
|
38
|
+
"""
|
|
39
|
+
Method that is responsible for communicating with the backend provider
|
|
40
|
+
to establish a new proctored exam
|
|
41
|
+
"""
|
|
42
|
+
raise NotImplementedError()
|
|
43
|
+
|
|
44
|
+
@abc.abstractmethod
|
|
45
|
+
def stop_exam_attempt(self, exam, attempt):
|
|
46
|
+
"""
|
|
47
|
+
Method that is responsible for communicating with the backend provider
|
|
48
|
+
to establish a new proctored exam
|
|
49
|
+
"""
|
|
50
|
+
raise NotImplementedError()
|
|
51
|
+
|
|
52
|
+
@abc.abstractmethod
|
|
53
|
+
def mark_erroneous_exam_attempt(self, exam, attempt):
|
|
54
|
+
"""
|
|
55
|
+
Method that is responsible for communicating with the backend provider
|
|
56
|
+
to establish a new proctored exam
|
|
57
|
+
"""
|
|
58
|
+
raise NotImplementedError()
|
|
59
|
+
|
|
60
|
+
@abc.abstractmethod
|
|
61
|
+
def remove_exam_attempt(self, exam, attempt):
|
|
62
|
+
"""
|
|
63
|
+
Method that removes the exam attempt from the backend's system
|
|
64
|
+
|
|
65
|
+
Return ``True`` when the provider confirms the attempt was removed, or that it is
|
|
66
|
+
already gone upstream. Return ``False`` when the provider responded without
|
|
67
|
+
confirming the removal; the caller then keeps the local attempt so the removal can
|
|
68
|
+
be retried instead of being silently dropped. Raise to signal that the provider
|
|
69
|
+
could not be reached at all.
|
|
70
|
+
"""
|
|
71
|
+
raise NotImplementedError()
|
|
72
|
+
|
|
73
|
+
@abc.abstractmethod
|
|
74
|
+
def get_software_download_url(self):
|
|
75
|
+
"""
|
|
76
|
+
Returns the URL that the user needs to go to in order to download
|
|
77
|
+
the corresponding desktop software
|
|
78
|
+
"""
|
|
79
|
+
raise NotImplementedError()
|
|
80
|
+
|
|
81
|
+
@abc.abstractmethod
|
|
82
|
+
def on_review_callback(self, attempt, payload):
|
|
83
|
+
"""
|
|
84
|
+
Called when the reviewing 3rd party service posts back the results
|
|
85
|
+
"""
|
|
86
|
+
raise NotImplementedError()
|
|
87
|
+
|
|
88
|
+
@abc.abstractmethod
|
|
89
|
+
def on_exam_saved(self, exam):
|
|
90
|
+
"""
|
|
91
|
+
Called after an exam is saved.
|
|
92
|
+
"""
|
|
93
|
+
raise NotImplementedError()
|
|
94
|
+
|
|
95
|
+
def get_javascript(self):
|
|
96
|
+
"""
|
|
97
|
+
Returns the backend javascript to embed on each proctoring page
|
|
98
|
+
"""
|
|
99
|
+
return ""
|
|
100
|
+
|
|
101
|
+
def get_exam(self, exam):
|
|
102
|
+
"""
|
|
103
|
+
Returns the backend's representation of the exam
|
|
104
|
+
Args:
|
|
105
|
+
dict: our exam object
|
|
106
|
+
Returns:
|
|
107
|
+
dict: backend exam object
|
|
108
|
+
"""
|
|
109
|
+
return exam
|
|
110
|
+
|
|
111
|
+
def get_attempt(self, attempt):
|
|
112
|
+
"""
|
|
113
|
+
Returns the backend's representation of the exam attempt
|
|
114
|
+
Args:
|
|
115
|
+
dict: our exam attempt object
|
|
116
|
+
Returns:
|
|
117
|
+
dict: backend exam attempt object
|
|
118
|
+
"""
|
|
119
|
+
return attempt
|
|
120
|
+
|
|
121
|
+
# pylint: disable=unused-argument,too-many-positional-arguments
|
|
122
|
+
def get_instructor_url(
|
|
123
|
+
self, course_id, user, exam_id=None, attempt_id=None,
|
|
124
|
+
show_configuration_dashboard=False, encrypted_video_review_url=None
|
|
125
|
+
):
|
|
126
|
+
"""
|
|
127
|
+
Returns the instructor dashboard url for reviews
|
|
128
|
+
"""
|
|
129
|
+
return None
|
|
130
|
+
|
|
131
|
+
# pylint: disable=unused-argument
|
|
132
|
+
def retire_user(self, user_id):
|
|
133
|
+
"""
|
|
134
|
+
Delete the stored user in the backend.
|
|
135
|
+
Returns boolean status of deletion, or None if this would be a no-op
|
|
136
|
+
"""
|
|
137
|
+
return None
|
|
138
|
+
|
|
139
|
+
def should_block_access_to_exam_material(self):
|
|
140
|
+
"""
|
|
141
|
+
Whether learner access to exam content should be blocked during the exam
|
|
142
|
+
"""
|
|
143
|
+
return False
|
|
144
|
+
|
|
145
|
+
# pylint: disable=unused-argument
|
|
146
|
+
def get_onboarding_profile_info(self, course_id, **kwargs):
|
|
147
|
+
"""
|
|
148
|
+
Returns onboarding profile information for a given course and optional user
|
|
149
|
+
"""
|
|
150
|
+
return None
|
|
151
|
+
|
|
152
|
+
def get_proctoring_config(self):
|
|
153
|
+
"""
|
|
154
|
+
Returns the metadata and configuration options for the proctoring service
|
|
155
|
+
"""
|
|
156
|
+
return None
|
|
157
|
+
|
|
158
|
+
def get_video_review_aes_key(self):
|
|
159
|
+
"""
|
|
160
|
+
Returns the aes key used for video review url encryption
|
|
161
|
+
"""
|
|
162
|
+
return None
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Implements a mock proctoring backend provider to be used for testing,
|
|
3
|
+
which doesn't require the setup and configuration of the Software Secure backend provider.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import threading
|
|
7
|
+
|
|
8
|
+
from edx_proctoring.backends.backend import ProctoringBackendProvider
|
|
9
|
+
from edx_proctoring.callbacks import start_exam_callback
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MockProctoringBackendProvider(ProctoringBackendProvider):
|
|
13
|
+
"""
|
|
14
|
+
Implementation of the ProctoringBackendProvider that bypasses proctoring setup.
|
|
15
|
+
"""
|
|
16
|
+
verbose_name = 'Mock Backend'
|
|
17
|
+
|
|
18
|
+
def __init__(self, *args, **kwargs):
|
|
19
|
+
ProctoringBackendProvider.__init__(self)
|
|
20
|
+
self.args = args
|
|
21
|
+
self.kwargs = kwargs
|
|
22
|
+
|
|
23
|
+
def register_exam_attempt(self, exam, context):
|
|
24
|
+
"""
|
|
25
|
+
Called when the exam attempt has been created but not started
|
|
26
|
+
|
|
27
|
+
Args
|
|
28
|
+
exam (dict) - a dictionary containing information about the exam
|
|
29
|
+
keys:
|
|
30
|
+
exam_name (str) - the name of the exam
|
|
31
|
+
course_id (str) - serialized course key of the course that the exam belongs to
|
|
32
|
+
id (str) - the id of the given exam
|
|
33
|
+
context (dict) - a dictionary containing information about the current exam context
|
|
34
|
+
keys:
|
|
35
|
+
attempt_code (str) - code that represents this current attempt
|
|
36
|
+
time_limit_mins (str) - time limit of exam in minutes
|
|
37
|
+
is_sample_attempt (bool) - True if this is a practice exam
|
|
38
|
+
callback_url (str) - url that we would like the external grader to call back to
|
|
39
|
+
full_name (str) - full name of the student taking the exam
|
|
40
|
+
review_policy (dict) - the policy for reviewing this exam
|
|
41
|
+
review_policy_exception (dict) - an exceptions that may exist for this review
|
|
42
|
+
email (str) - the email address of the student
|
|
43
|
+
|
|
44
|
+
Returns
|
|
45
|
+
string that corresponds to the backend record locator of the attempt
|
|
46
|
+
"""
|
|
47
|
+
# Since the code expects this callback to be coming from the external software, we wait
|
|
48
|
+
# to call it so that the attempt is created properly before the callback is called.
|
|
49
|
+
timer = threading.Timer(1.0, start_exam_callback, args=(None, context['attempt_code']))
|
|
50
|
+
timer.start()
|
|
51
|
+
return context['attempt_code']
|
|
52
|
+
|
|
53
|
+
def start_exam_attempt(self, exam, attempt):
|
|
54
|
+
"""
|
|
55
|
+
Method that is responsible for communicating with the backend provider
|
|
56
|
+
to establish a new proctored exam
|
|
57
|
+
"""
|
|
58
|
+
return None
|
|
59
|
+
|
|
60
|
+
def stop_exam_attempt(self, exam, attempt):
|
|
61
|
+
"""
|
|
62
|
+
Method that is responsible for communicating with the backend provider
|
|
63
|
+
to establish a new proctored exam
|
|
64
|
+
"""
|
|
65
|
+
return None
|
|
66
|
+
|
|
67
|
+
def mark_erroneous_exam_attempt(self, exam, attempt):
|
|
68
|
+
"""
|
|
69
|
+
Method that would be responsible for communicating with the
|
|
70
|
+
backend provider to mark a proctored session as having
|
|
71
|
+
encountered a technical error
|
|
72
|
+
"""
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
def remove_exam_attempt(self, exam, attempt):
|
|
76
|
+
return True
|
|
77
|
+
|
|
78
|
+
def get_software_download_url(self):
|
|
79
|
+
"""
|
|
80
|
+
Returns
|
|
81
|
+
the URL that the user needs to go to in order to download
|
|
82
|
+
the corresponding desktop software
|
|
83
|
+
"""
|
|
84
|
+
return "mockurl"
|
|
85
|
+
|
|
86
|
+
def on_review_callback(self, attempt, payload):
|
|
87
|
+
"""
|
|
88
|
+
Called when the reviewing 3rd party service posts back the results
|
|
89
|
+
|
|
90
|
+
Args
|
|
91
|
+
payload (dict) -
|
|
92
|
+
the payload from the external service - is service dependent
|
|
93
|
+
|
|
94
|
+
Returns nothing
|
|
95
|
+
|
|
96
|
+
Side Effects
|
|
97
|
+
- updates review status
|
|
98
|
+
"""
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
def on_exam_saved(self, exam):
|
|
102
|
+
"""
|
|
103
|
+
Called after an exam is saved.
|
|
104
|
+
"""
|
|
105
|
+
return None
|