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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Implementation of a backend provider, which does nothing
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from edx_proctoring.backends.backend import ProctoringBackendProvider
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class NullBackendProvider(ProctoringBackendProvider):
|
|
9
|
+
"""
|
|
10
|
+
Implementation of the ProctoringBackendProvider that does nothing
|
|
11
|
+
"""
|
|
12
|
+
verbose_name = 'Null Backend'
|
|
13
|
+
|
|
14
|
+
def register_exam_attempt(self, exam, context):
|
|
15
|
+
"""
|
|
16
|
+
Called when the exam attempt has been created but not started
|
|
17
|
+
"""
|
|
18
|
+
return None
|
|
19
|
+
|
|
20
|
+
def start_exam_attempt(self, exam, attempt):
|
|
21
|
+
"""
|
|
22
|
+
Method that is responsible for communicating with the backend provider
|
|
23
|
+
to establish a new proctored exam
|
|
24
|
+
"""
|
|
25
|
+
return None
|
|
26
|
+
|
|
27
|
+
def stop_exam_attempt(self, exam, attempt):
|
|
28
|
+
"""
|
|
29
|
+
Method that is responsible for communicating with the backend provider
|
|
30
|
+
to establish a new proctored exam
|
|
31
|
+
"""
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
def mark_erroneous_exam_attempt(self, exam, attempt):
|
|
35
|
+
"""
|
|
36
|
+
Method that would be responsible for communicating with the
|
|
37
|
+
backend provider to mark a proctored session as having
|
|
38
|
+
encountered a technical error
|
|
39
|
+
"""
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
def remove_exam_attempt(self, exam, attempt):
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
def get_software_download_url(self):
|
|
46
|
+
"""
|
|
47
|
+
Returns the URL that the user needs to go to in order to download
|
|
48
|
+
the corresponding desktop software
|
|
49
|
+
"""
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
def on_review_callback(self, attempt, payload):
|
|
53
|
+
"""
|
|
54
|
+
Called when the reviewing 3rd party service posts back the results
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
def on_exam_saved(self, exam):
|
|
58
|
+
"""
|
|
59
|
+
Called after an exam is saved.
|
|
60
|
+
"""
|
|
61
|
+
return None
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Base implementation of a REST backend, following the API documented in
|
|
3
|
+
docs/backends.rst
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
import time
|
|
8
|
+
import uuid
|
|
9
|
+
import warnings
|
|
10
|
+
from urllib.parse import urlencode, urlparse
|
|
11
|
+
|
|
12
|
+
import jwt
|
|
13
|
+
from edx_rest_api_client.client import OAuthAPIClient
|
|
14
|
+
from webpack_loader.exceptions import BaseWebpackLoaderException, WebpackBundleLookupError
|
|
15
|
+
from webpack_loader.utils import get_files
|
|
16
|
+
|
|
17
|
+
from django.conf import settings
|
|
18
|
+
|
|
19
|
+
from edx_proctoring.backends.backend import ProctoringBackendProvider
|
|
20
|
+
from edx_proctoring.exceptions import (
|
|
21
|
+
BackendProviderCannotRegisterAttempt,
|
|
22
|
+
BackendProviderCannotRetireUser,
|
|
23
|
+
BackendProviderOnboardingException,
|
|
24
|
+
BackendProviderOnboardingProfilesException,
|
|
25
|
+
BackendProviderSentNoAttemptID
|
|
26
|
+
)
|
|
27
|
+
from edx_proctoring.statuses import ProctoredExamStudentAttemptStatus, SoftwareSecureReviewStatus
|
|
28
|
+
|
|
29
|
+
log = logging.getLogger(__name__)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class BaseRestProctoringProvider(ProctoringBackendProvider):
|
|
33
|
+
"""
|
|
34
|
+
Base class for official REST API proctoring service.
|
|
35
|
+
Subclasses must override base_url and may override the other url
|
|
36
|
+
properties
|
|
37
|
+
"""
|
|
38
|
+
base_url = None
|
|
39
|
+
token_expiration_time = 60
|
|
40
|
+
needs_oauth = True
|
|
41
|
+
has_dashboard = True
|
|
42
|
+
supports_onboarding = True
|
|
43
|
+
passing_statuses = (SoftwareSecureReviewStatus.clean,)
|
|
44
|
+
# Timeout (in seconds) for every outbound request to the provider, so a slow or
|
|
45
|
+
# unavailable provider cannot hang the request indefinitely. ``requests`` applies this
|
|
46
|
+
# as two separate inactivity limits -- how long to wait to connect, and how long to wait
|
|
47
|
+
# for more data -- not as a cap on total request time, so a response that keeps
|
|
48
|
+
# trickling can outlast it. A ``(connect, read)`` tuple sets those two phases
|
|
49
|
+
# independently. Overridable per backend via a ``timeout`` key in
|
|
50
|
+
# ``PROCTORING_BACKENDS``.
|
|
51
|
+
timeout = 30
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def exam_attempt_url(self):
|
|
55
|
+
"Returns exam attempt url"
|
|
56
|
+
return self.base_url + '/api/v1/exam/{exam_id}/attempt/{attempt_id}/'
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def create_exam_attempt_url(self):
|
|
60
|
+
"Returns the create exam url"
|
|
61
|
+
return self.base_url + '/api/v1/exam/{exam_id}/attempt/'
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def create_exam_url(self):
|
|
65
|
+
"Returns create exam url"
|
|
66
|
+
return self.base_url + '/api/v1/exam/'
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def exam_url(self):
|
|
70
|
+
"Returns exam url"
|
|
71
|
+
return self.base_url + '/api/v1/exam/{exam_id}/'
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def config_url(self):
|
|
75
|
+
"Returns proctor config url"
|
|
76
|
+
return self.base_url + '/api/v1/config/'
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def instructor_url(self):
|
|
80
|
+
"Returns the instructor dashboard url"
|
|
81
|
+
return self.base_url + '/api/v1/instructor/{client_id}/?jwt={jwt}'
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def user_info_url(self):
|
|
85
|
+
"Returns the user info url"
|
|
86
|
+
return self.base_url + '/api/v1/user/{user_id}/'
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def onboarding_statuses_url(self):
|
|
90
|
+
"Returns the onboarding statuses url"
|
|
91
|
+
return self.base_url + '/api/v1/courses/{course_id}/onboarding_statuses'
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def proctoring_instructions(self):
|
|
95
|
+
"Returns the (optional) proctoring instructions"
|
|
96
|
+
return []
|
|
97
|
+
|
|
98
|
+
def __init__(self, client_id=None, client_secret=None, **kwargs):
|
|
99
|
+
"""
|
|
100
|
+
Initialize REST backend.
|
|
101
|
+
client_id: provided by backend service
|
|
102
|
+
client_secret: provided by backend service
|
|
103
|
+
"""
|
|
104
|
+
self.default_rules = None
|
|
105
|
+
super().__init__(**kwargs)
|
|
106
|
+
self.client_id = client_id
|
|
107
|
+
self.client_secret = client_secret
|
|
108
|
+
self.session = OAuthAPIClient(self.base_url, self.client_id, self.client_secret)
|
|
109
|
+
|
|
110
|
+
def get_javascript(self):
|
|
111
|
+
"""
|
|
112
|
+
Returns the url of the javascript bundle into which the provider's JS will be loaded
|
|
113
|
+
"""
|
|
114
|
+
# use the defined npm_module name, or else the python package name
|
|
115
|
+
package = getattr(self, 'npm_module', self.__class__.__module__.split('.', maxsplit=1)[0])
|
|
116
|
+
js_url = ''
|
|
117
|
+
try:
|
|
118
|
+
bundle_chunks = get_files(package, config="WORKERS")
|
|
119
|
+
# still necessary to check, since webpack_loader can be
|
|
120
|
+
# configured to ignore all matching packages
|
|
121
|
+
if bundle_chunks:
|
|
122
|
+
js_url = bundle_chunks[0]["url"]
|
|
123
|
+
|
|
124
|
+
except WebpackBundleLookupError:
|
|
125
|
+
warnings.warn(
|
|
126
|
+
f'Could not find webpack bundle for proctoring backend {package}.'
|
|
127
|
+
' Check whether webpack is configured to build such a bundle'
|
|
128
|
+
)
|
|
129
|
+
except BaseWebpackLoaderException:
|
|
130
|
+
warnings.warn(
|
|
131
|
+
f'Could not find webpack bundle for proctoring backend {package}.'
|
|
132
|
+
)
|
|
133
|
+
except IOError as err:
|
|
134
|
+
warnings.warn(
|
|
135
|
+
f'Webpack stats file corresponding to WebWorkers not found: {str(err)}'
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# if the Javascript URL is not an absolute URL (i.e. doesn't have a scheme), prepend
|
|
139
|
+
# the LMS Root URL to it, if it is defined, to make it an absolute URL
|
|
140
|
+
if not urlparse(js_url).scheme:
|
|
141
|
+
if hasattr(settings, 'LMS_ROOT_URL'):
|
|
142
|
+
js_url = settings.LMS_ROOT_URL + js_url
|
|
143
|
+
|
|
144
|
+
return js_url
|
|
145
|
+
|
|
146
|
+
def get_software_download_url(self):
|
|
147
|
+
"""
|
|
148
|
+
Returns the URL that the user needs to go to in order to download
|
|
149
|
+
the corresponding desktop software
|
|
150
|
+
"""
|
|
151
|
+
return self.get_proctoring_config().get('download_url', None)
|
|
152
|
+
|
|
153
|
+
def get_proctoring_config(self):
|
|
154
|
+
"""
|
|
155
|
+
Returns the metadata and configuration options for the proctoring service
|
|
156
|
+
"""
|
|
157
|
+
url = self.config_url
|
|
158
|
+
log.debug('Requesting config from %r', url)
|
|
159
|
+
response = self.session.get(url, headers=self._get_language_headers(), timeout=self.timeout).json()
|
|
160
|
+
return response
|
|
161
|
+
|
|
162
|
+
def get_exam(self, exam):
|
|
163
|
+
"""
|
|
164
|
+
Returns the exam metadata stored by the proctoring service
|
|
165
|
+
"""
|
|
166
|
+
url = self.exam_url.format(exam_id=exam['id'])
|
|
167
|
+
log.debug('Requesting exam from %r', url)
|
|
168
|
+
response = self.session.get(url, timeout=self.timeout).json()
|
|
169
|
+
return response
|
|
170
|
+
|
|
171
|
+
def get_attempt(self, attempt):
|
|
172
|
+
"""
|
|
173
|
+
Returns the attempt object from the backend
|
|
174
|
+
"""
|
|
175
|
+
response = self._make_attempt_request(
|
|
176
|
+
attempt['proctored_exam']['external_id'],
|
|
177
|
+
attempt['external_id'],
|
|
178
|
+
method='GET')
|
|
179
|
+
# If the class has instructions defined, use them.
|
|
180
|
+
# Otherwise, the instructions should be returned by this
|
|
181
|
+
# API request. Subclasses should wrap each instruction with gettext
|
|
182
|
+
response['instructions'] = self.proctoring_instructions or response.get('instructions', [])
|
|
183
|
+
return response
|
|
184
|
+
|
|
185
|
+
def register_exam_attempt(self, exam, context):
|
|
186
|
+
"""
|
|
187
|
+
Called when the exam attempt has been created but not started
|
|
188
|
+
"""
|
|
189
|
+
url = self.create_exam_attempt_url.format(exam_id=exam['external_id'])
|
|
190
|
+
payload = context
|
|
191
|
+
payload['status'] = 'created'
|
|
192
|
+
# attempt code isn't needed in this API
|
|
193
|
+
payload.pop('attempt_code', False)
|
|
194
|
+
log.debug(
|
|
195
|
+
'Creating exam attempt for exam_id=%(exam_id)i (external_id=%(external_id)s) at %(url)s',
|
|
196
|
+
{'exam_id': exam['id'], 'external_id': exam['external_id'], 'url': url}
|
|
197
|
+
)
|
|
198
|
+
response = self.session.post(url, json=payload, timeout=self.timeout)
|
|
199
|
+
if response.status_code != 200:
|
|
200
|
+
raise BackendProviderCannotRegisterAttempt(response.content, response.status_code)
|
|
201
|
+
status_code = response.status_code
|
|
202
|
+
response = response.json()
|
|
203
|
+
log.debug(response)
|
|
204
|
+
onboarding_status = response.get('status', None)
|
|
205
|
+
if onboarding_status in ProctoredExamStudentAttemptStatus.onboarding_errors:
|
|
206
|
+
raise BackendProviderOnboardingException(onboarding_status)
|
|
207
|
+
attempt_id = response.get('id', None)
|
|
208
|
+
if not attempt_id:
|
|
209
|
+
raise BackendProviderSentNoAttemptID(response, status_code)
|
|
210
|
+
return attempt_id
|
|
211
|
+
|
|
212
|
+
def start_exam_attempt(self, exam, attempt):
|
|
213
|
+
"""
|
|
214
|
+
Method that is responsible for communicating with the backend provider
|
|
215
|
+
to establish a new proctored exam
|
|
216
|
+
"""
|
|
217
|
+
response = self._make_attempt_request(
|
|
218
|
+
exam,
|
|
219
|
+
attempt,
|
|
220
|
+
status=ProctoredExamStudentAttemptStatus.started,
|
|
221
|
+
method='PATCH')
|
|
222
|
+
return response.get('status')
|
|
223
|
+
|
|
224
|
+
def stop_exam_attempt(self, exam, attempt):
|
|
225
|
+
"""
|
|
226
|
+
Method that is responsible for communicating with the backend provider
|
|
227
|
+
to finish a proctored exam
|
|
228
|
+
"""
|
|
229
|
+
response = self._make_attempt_request(
|
|
230
|
+
exam,
|
|
231
|
+
attempt,
|
|
232
|
+
status=ProctoredExamStudentAttemptStatus.submitted,
|
|
233
|
+
method='PATCH')
|
|
234
|
+
return response.get('status')
|
|
235
|
+
|
|
236
|
+
def remove_exam_attempt(self, exam, attempt):
|
|
237
|
+
"""
|
|
238
|
+
Removes the exam attempt on the backend provider's server.
|
|
239
|
+
|
|
240
|
+
Returns ``True`` when the provider confirms removal with the documented
|
|
241
|
+
``{"status": "deleted"}`` payload, or on a ``404`` (the attempt is already gone
|
|
242
|
+
upstream, so a retried reset converges). Returns ``False`` when the provider responds
|
|
243
|
+
but does not confirm deletion (undecodable body or an unexpected status); the API
|
|
244
|
+
layer decides whether that is fatal. Any other HTTP error is raised so a transient
|
|
245
|
+
failure keeps the local attempt available for a later retry.
|
|
246
|
+
"""
|
|
247
|
+
if not attempt:
|
|
248
|
+
return False
|
|
249
|
+
url = self.exam_attempt_url.format(exam_id=exam, attempt_id=attempt)
|
|
250
|
+
log.debug('Removing attempt at %r', url)
|
|
251
|
+
response = self.session.request('DELETE', url, timeout=self.timeout)
|
|
252
|
+
if response.status_code == 404:
|
|
253
|
+
return True
|
|
254
|
+
response.raise_for_status()
|
|
255
|
+
try:
|
|
256
|
+
data = response.json()
|
|
257
|
+
except ValueError:
|
|
258
|
+
log.exception('Decoding attempt removal %r -> %r', attempt, response.content)
|
|
259
|
+
return False
|
|
260
|
+
return data.get('status', None) == 'deleted'
|
|
261
|
+
|
|
262
|
+
def mark_erroneous_exam_attempt(self, exam, attempt):
|
|
263
|
+
"""
|
|
264
|
+
Method that is responsible for communicating with the backend provider
|
|
265
|
+
to mark an unfinished exam to be in error
|
|
266
|
+
"""
|
|
267
|
+
response = self._make_attempt_request(
|
|
268
|
+
exam,
|
|
269
|
+
attempt,
|
|
270
|
+
status=ProctoredExamStudentAttemptStatus.error,
|
|
271
|
+
method='PATCH')
|
|
272
|
+
return response.get('status')
|
|
273
|
+
|
|
274
|
+
def on_review_callback(self, attempt, payload):
|
|
275
|
+
"""
|
|
276
|
+
Called when the reviewing 3rd party service posts back the results
|
|
277
|
+
"""
|
|
278
|
+
# REST backends should convert the payload into the expected data structure
|
|
279
|
+
return payload
|
|
280
|
+
|
|
281
|
+
def on_exam_saved(self, exam):
|
|
282
|
+
"""
|
|
283
|
+
Called after an exam is saved.
|
|
284
|
+
"""
|
|
285
|
+
if self.default_rules and not exam.get('rules', None):
|
|
286
|
+
# allows the platform to define a default configuration
|
|
287
|
+
exam['rules'] = self.default_rules
|
|
288
|
+
external_id = exam.get('external_id', None)
|
|
289
|
+
if external_id:
|
|
290
|
+
url = self.exam_url.format(exam_id=external_id)
|
|
291
|
+
else:
|
|
292
|
+
url = self.create_exam_url
|
|
293
|
+
log.info(
|
|
294
|
+
'Saving exam_id=%(exam_id)i to %(url)s',
|
|
295
|
+
{'exam_id': exam['id'], 'url': url}
|
|
296
|
+
)
|
|
297
|
+
response = None
|
|
298
|
+
try:
|
|
299
|
+
response = self.session.post(url, json=exam, timeout=self.timeout)
|
|
300
|
+
data = response.json()
|
|
301
|
+
except Exception as exc: # pylint: disable=broad-exception-caught
|
|
302
|
+
if response:
|
|
303
|
+
if hasattr(exc, 'response') and exc.response is not None:
|
|
304
|
+
content = exc.response.content
|
|
305
|
+
else:
|
|
306
|
+
content = response.content
|
|
307
|
+
else:
|
|
308
|
+
content = None
|
|
309
|
+
log.exception(
|
|
310
|
+
'Failed to save exam_id=%(exam_id)i to %(url)s. Response: %(content)s',
|
|
311
|
+
{'exam_id': exam['id'], 'url': url, 'content': content}
|
|
312
|
+
)
|
|
313
|
+
data = {}
|
|
314
|
+
return data.get('id')
|
|
315
|
+
|
|
316
|
+
# pylint: disable=too-many-positional-arguments
|
|
317
|
+
def get_instructor_url(
|
|
318
|
+
self, course_id, user, exam_id=None, attempt_id=None,
|
|
319
|
+
show_configuration_dashboard=False, encrypted_video_review_url=None
|
|
320
|
+
):
|
|
321
|
+
"""
|
|
322
|
+
Return a URL to the instructor dashboard
|
|
323
|
+
course_id: str
|
|
324
|
+
user: dict of {id, full_name, email} for the instructor or reviewer
|
|
325
|
+
exam_id: str optional exam external id
|
|
326
|
+
attempt_id: str optional exam attempt external id
|
|
327
|
+
"""
|
|
328
|
+
exp = time.time() + self.token_expiration_time
|
|
329
|
+
token = {
|
|
330
|
+
'course_id': course_id,
|
|
331
|
+
'user': user,
|
|
332
|
+
'iss': self.client_id,
|
|
333
|
+
'jti': uuid.uuid4().hex,
|
|
334
|
+
'exp': exp
|
|
335
|
+
}
|
|
336
|
+
if exam_id:
|
|
337
|
+
token['exam_id'] = exam_id
|
|
338
|
+
if show_configuration_dashboard:
|
|
339
|
+
token['config'] = True
|
|
340
|
+
if attempt_id:
|
|
341
|
+
token['attempt_id'] = attempt_id
|
|
342
|
+
encoded = jwt.encode(token, self.client_secret)
|
|
343
|
+
url = self.instructor_url.format(client_id=self.client_id, jwt=encoded)
|
|
344
|
+
|
|
345
|
+
log.debug(
|
|
346
|
+
('Created instructor url for course_id=%(course_id)s exam_id=%(exam_id)i '
|
|
347
|
+
'attempt_id=%(attempt_id)s'),
|
|
348
|
+
{'course_id': course_id, 'exam_id': exam_id, 'attempt_id': attempt_id}
|
|
349
|
+
)
|
|
350
|
+
return url
|
|
351
|
+
|
|
352
|
+
def retire_user(self, user_id):
|
|
353
|
+
url = self.user_info_url.format(user_id=user_id)
|
|
354
|
+
response = None
|
|
355
|
+
try:
|
|
356
|
+
response = self.session.delete(url, timeout=self.timeout)
|
|
357
|
+
data = response.json()
|
|
358
|
+
assert data in (True, False)
|
|
359
|
+
except Exception as exc:
|
|
360
|
+
# pylint: disable=no-member
|
|
361
|
+
if hasattr(exc, 'response') and exc.response is not None:
|
|
362
|
+
content = exc.response.content
|
|
363
|
+
elif response is not None:
|
|
364
|
+
content = response.content
|
|
365
|
+
else:
|
|
366
|
+
# The request failed before a response was received (e.g. a timeout), so
|
|
367
|
+
# there is no body to include.
|
|
368
|
+
content = None
|
|
369
|
+
raise BackendProviderCannotRetireUser(content) from exc
|
|
370
|
+
return data
|
|
371
|
+
|
|
372
|
+
def get_onboarding_profile_info(self, course_id, **kwargs):
|
|
373
|
+
url = self.onboarding_statuses_url.format(course_id=course_id)
|
|
374
|
+
if kwargs:
|
|
375
|
+
query_string = urlencode(kwargs)
|
|
376
|
+
url += '?' + query_string
|
|
377
|
+
|
|
378
|
+
response = self.session.get(url, timeout=self.timeout)
|
|
379
|
+
|
|
380
|
+
if response.status_code != 200:
|
|
381
|
+
raise BackendProviderOnboardingProfilesException(response.content, response.status_code)
|
|
382
|
+
data = response.json()
|
|
383
|
+
return data
|
|
384
|
+
|
|
385
|
+
def _get_language_headers(self):
|
|
386
|
+
"""
|
|
387
|
+
Returns a dictionary of the Accept-Language headers
|
|
388
|
+
"""
|
|
389
|
+
# This import is here because developers writing backends which subclass this class
|
|
390
|
+
# may want to import this module and use the other methods, without having to run in the context
|
|
391
|
+
# of django settings, etc.
|
|
392
|
+
from django.utils.translation import get_language # pylint: disable=import-outside-toplevel
|
|
393
|
+
|
|
394
|
+
current_lang = get_language()
|
|
395
|
+
default_lang = settings.LANGUAGE_CODE
|
|
396
|
+
lang_header = default_lang
|
|
397
|
+
if current_lang and current_lang != default_lang:
|
|
398
|
+
lang_header = f'{current_lang};{default_lang}'
|
|
399
|
+
return {'Accept-Language': lang_header}
|
|
400
|
+
|
|
401
|
+
def _make_attempt_request(self, exam, attempt, method='POST', status=None, **payload):
|
|
402
|
+
"""
|
|
403
|
+
Calls backend attempt API
|
|
404
|
+
"""
|
|
405
|
+
if not attempt:
|
|
406
|
+
return {}
|
|
407
|
+
if status:
|
|
408
|
+
payload['status'] = status
|
|
409
|
+
else:
|
|
410
|
+
payload = None
|
|
411
|
+
url = self.exam_attempt_url.format(exam_id=exam, attempt_id=attempt)
|
|
412
|
+
headers = {}
|
|
413
|
+
if method == 'GET':
|
|
414
|
+
headers.update(self._get_language_headers())
|
|
415
|
+
log.debug('Making %r attempt request at %r', method, url)
|
|
416
|
+
response = self.session.request(method, url, json=payload, headers=headers, timeout=self.timeout)
|
|
417
|
+
try:
|
|
418
|
+
data = response.json()
|
|
419
|
+
except ValueError:
|
|
420
|
+
log.exception("Decoding attempt %r -> %r", attempt, response.content)
|
|
421
|
+
data = {}
|
|
422
|
+
return data
|