From 183d79b04182f6b9c2e0134ed270cfc7f62f00a5 Mon Sep 17 00:00:00 2001
From: Philipp Imhof <52650214+PhilippImhof@users.noreply.github.com>
Date: Wed, 26 Mar 2025 18:01:08 +0100
Subject: [PATCH] MDL-85023 quiz: allow WebRTC with SEB on Mac
---
.../seb/classes/seb_quiz_settings.php | 12 +++++++++
.../seb/classes/settings_provider.php | 8 ++++++
mod/quiz/accessrule/seb/db/access.php | 16 ++++++++++++
mod/quiz/accessrule/seb/db/install.php | 2 ++
mod/quiz/accessrule/seb/db/install.xml | 2 ++
mod/quiz/accessrule/seb/db/upgrade.php | 26 +++++++++++++++++++
.../accessrule/seb/lang/en/quizaccess_seb.php | 6 +++++
mod/quiz/accessrule/seb/rule.php | 2 ++
.../seb/tests/behat/edit_form.feature | 22 +++++++++++-----
mod/quiz/accessrule/seb/tests/helper_test.php | 4 ++-
.../seb/tests/quiz_settings_test.php | 14 +++++++---
.../seb/tests/settings_provider_test.php | 26 ++++++++++++++++++-
.../accessrule/seb/tests/template_test.php | 4 +++
.../seb/tests/test_helper_trait.php | 2 ++
mod/quiz/accessrule/seb/version.php | 2 +-
.../backup/moodle2/restore_quiz_stepslib.php | 2 ++
16 files changed, 138 insertions(+), 12 deletions(-)
diff --git a/mod/quiz/accessrule/seb/classes/seb_quiz_settings.php b/mod/quiz/accessrule/seb/classes/seb_quiz_settings.php
index 1e338b49786..60b0cf5e1ce 100644
--- a/mod/quiz/accessrule/seb/classes/seb_quiz_settings.php
+++ b/mod/quiz/accessrule/seb/classes/seb_quiz_settings.php
@@ -134,6 +134,16 @@ class seb_quiz_settings extends persistent {
'default' => 0,
'null' => NULL_ALLOWED,
],
+ 'allowcapturecamera' => [
+ 'type' => PARAM_INT,
+ 'default' => 0,
+ 'null' => NULL_ALLOWED,
+ ],
+ 'allowcapturemicrophone' => [
+ 'type' => PARAM_INT,
+ 'default' => 0,
+ 'null' => NULL_ALLOWED,
+ ],
'allowspellchecking' => [
'type' => PARAM_INT,
'default' => 0,
@@ -644,6 +654,8 @@ class seb_quiz_settings extends persistent {
'allowreloadinexam' => 'browserWindowAllowReload',
'allowuserquitseb' => 'allowQuit',
'enableaudiocontrol' => 'audioControlEnabled',
+ 'allowcapturecamera' => 'browserMediaCaptureCamera',
+ 'allowcapturemicrophone' => 'browserMediaCaptureMicrophone',
'filterembeddedcontent' => 'URLFilterEnableContentFilter',
'muteonstartup' => 'audioMute',
'showkeyboardlayout' => 'showInputLanguage',
diff --git a/mod/quiz/accessrule/seb/classes/settings_provider.php b/mod/quiz/accessrule/seb/classes/settings_provider.php
index f374a4bb82b..4329304d52f 100644
--- a/mod/quiz/accessrule/seb/classes/settings_provider.php
+++ b/mod/quiz/accessrule/seb/classes/settings_provider.php
@@ -472,6 +472,8 @@ class settings_provider {
'seb_showwificontrol' => 'selectyesno',
'seb_enableaudiocontrol' => 'selectyesno',
'seb_muteonstartup' => 'selectyesno',
+ 'seb_allowcapturecamera' => 'selectyesno',
+ 'seb_allowcapturemicrophone' => 'selectyesno',
'seb_allowspellchecking' => 'selectyesno',
'seb_activateurlfiltering' => 'selectyesno',
'seb_filterembeddedcontent' => 'selectyesno',
@@ -501,6 +503,8 @@ class settings_provider {
'seb_showwificontrol' => PARAM_BOOL,
'seb_enableaudiocontrol' => PARAM_BOOL,
'seb_muteonstartup' => PARAM_BOOL,
+ 'seb_allowcapturecamera' => PARAM_BOOL,
+ 'seb_allowcapturemicrophone' => PARAM_BOOL,
'seb_allowspellchecking' => PARAM_BOOL,
'seb_activateurlfiltering' => PARAM_BOOL,
'seb_filterembeddedcontent' => PARAM_BOOL,
@@ -645,6 +649,8 @@ class settings_provider {
'seb_showkeyboardlayout' => 1,
'seb_showwificontrol' => 0,
'seb_enableaudiocontrol' => 0,
+ 'seb_allowcapturecamera' => 0,
+ 'seb_allowcapturemicrophone' => 0,
'seb_muteonstartup' => 0,
'seb_allowspellchecking' => 0,
'seb_activateurlfiltering' => 0,
@@ -914,6 +920,8 @@ class settings_provider {
'seb_enableaudiocontrol' => [
'seb_muteonstartup' => [],
],
+ 'seb_allowcapturecamera' => [],
+ 'seb_allowcapturemicrophone' => [],
'seb_allowspellchecking' => [],
'seb_activateurlfiltering' => [
'seb_filterembeddedcontent' => [],
diff --git a/mod/quiz/accessrule/seb/db/access.php b/mod/quiz/accessrule/seb/db/access.php
index 2972b868892..1b02068cbdf 100644
--- a/mod/quiz/accessrule/seb/db/access.php
+++ b/mod/quiz/accessrule/seb/db/access.php
@@ -198,6 +198,22 @@ $capabilities = [
'editingteacher' => CAP_ALLOW
]
],
+ 'quizaccess/seb:manage_seb_allowcapturecamera' => [
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'archetypes' => [
+ 'manager' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ ],
+ ],
+ 'quizaccess/seb:manage_seb_allowcapturemicrophone' => [
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'archetypes' => [
+ 'manager' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ ],
+ ],
'quizaccess/seb:manage_seb_allowspellchecking' => [
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
diff --git a/mod/quiz/accessrule/seb/db/install.php b/mod/quiz/accessrule/seb/db/install.php
index 5598e4c947e..baa8d8490ad 100644
--- a/mod/quiz/accessrule/seb/db/install.php
+++ b/mod/quiz/accessrule/seb/db/install.php
@@ -64,6 +64,8 @@ function xmldb_quizaccess_seb_install() {
$sebsettings->userconfirmquit = null;
$sebsettings->enableaudiocontrol = null;
$sebsettings->muteonstartup = null;
+ $sebsettings->allowcapturecamera = null;
+ $sebsettings->allowcapturemicrophone = null;
$sebsettings->allowspellchecking = null;
$sebsettings->allowreloadinexam = null;
$sebsettings->activateurlfiltering = null;
diff --git a/mod/quiz/accessrule/seb/db/install.xml b/mod/quiz/accessrule/seb/db/install.xml
index 17caa56b3c3..dd10629e241 100644
--- a/mod/quiz/accessrule/seb/db/install.xml
+++ b/mod/quiz/accessrule/seb/db/install.xml
@@ -22,6 +22,8 @@
+
+
diff --git a/mod/quiz/accessrule/seb/db/upgrade.php b/mod/quiz/accessrule/seb/db/upgrade.php
index de0b9f953a1..e4dab0e9b7f 100644
--- a/mod/quiz/accessrule/seb/db/upgrade.php
+++ b/mod/quiz/accessrule/seb/db/upgrade.php
@@ -34,6 +34,9 @@ require_once($CFG->dirroot . '/mod/quiz/accessrule/seb/lib.php');
* @return bool Result.
*/
function xmldb_quizaccess_seb_upgrade($oldversion) {
+ global $DB;
+ $dbman = $DB->get_manager();
+
// Automatically generated Moodle v4.2.0 release upgrade line.
// Put any upgrade step following this.
@@ -46,5 +49,28 @@ function xmldb_quizaccess_seb_upgrade($oldversion) {
// Automatically generated Moodle v4.5.0 release upgrade line.
// Put any upgrade step following this.
+ if ($oldversion < 2024121801) {
+
+ // Define field allowcapturecamera to be added to quizaccess_seb_quizsettings.
+ $table = new xmldb_table('quizaccess_seb_quizsettings');
+ $field = new xmldb_field('allowcapturecamera', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'muteonstartup');
+
+ // Conditionally launch add field allowcapturecamera.
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Define field allowcapturemicrophone to be added to quizaccess_seb_quizsettings.
+ $field = new xmldb_field('allowcapturemicrophone', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'allowcapturecamera');
+
+ // Conditionally launch add field allowcapturemicrophone.
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Seb savepoint reached.
+ upgrade_plugin_savepoint(true, 2024121801, 'quizaccess', 'seb');
+ }
+
return true;
}
diff --git a/mod/quiz/accessrule/seb/lang/en/quizaccess_seb.php b/mod/quiz/accessrule/seb/lang/en/quizaccess_seb.php
index c6e307f3da0..f0d7b9d1482 100644
--- a/mod/quiz/accessrule/seb/lang/en/quizaccess_seb.php
+++ b/mod/quiz/accessrule/seb/lang/en/quizaccess_seb.php
@@ -92,6 +92,8 @@ $string['seb'] = 'Safe Exam Browser';
$string['seb:bypassseb'] = 'Bypass the requirement to view quiz in Safe Exam Browser.';
$string['seb:manage_filemanager_sebconfigfile'] = 'Change SEB quiz setting: Select SEB config file';
$string['seb:manage_seb_activateurlfiltering'] = 'Change SEB quiz setting: Activate URL filtering';
+$string['seb:manage_seb_allowcapturecamera'] = 'Change SEB quiz setting: Allow browser access to camera';
+$string['seb:manage_seb_allowcapturemicrophone'] = 'Change SEB quiz setting: Allow browser access to microphone';
$string['seb:manage_seb_allowedbrowserexamkeys'] = 'Change SEB quiz setting: Allowed browser exam keys';
$string['seb:manage_seb_allowreloadinexam'] = 'Change SEB quiz setting: Allow reload';
$string['seb:manage_seb_allowspellchecking'] = 'Change SEB quiz setting: Enable spell checking';
@@ -119,6 +121,10 @@ $string['seb:manage_seb_usesebclientconfig'] = 'Change SEB quiz setting: Use SEB
$string['seb:managetemplates'] = 'Manage SEB configuration templates';
$string['seb_activateurlfiltering'] = 'Enable URL filtering';
$string['seb_activateurlfiltering_help'] = 'If enabled, URLs will be filtered when loading web pages. The filter set has to be defined below.';
+$string['seb_allowcapturecamera'] = 'Allow browser access to camera';
+$string['seb_allowcapturecamera_help'] = 'If enabled, users will be asked to grant access to the camera for SEB before the exam session is started. In macOS 12/iOS 15 or later, disabling this setting prevents web applications from accessing the camera in any case, i. e. video recording via WebRTC will not be possible.';
+$string['seb_allowcapturemicrophone'] = 'Allow browser access to microphone';
+$string['seb_allowcapturemicrophone_help'] = 'If enabled, users will be asked to grant access to the microphone for SEB before the exam session is started. In macOS 12/iOS 15 or later, disabling this setting prevents web applications from accessing the microphone in any case, i. e. audio recording via WebRTC will not be possible.';
$string['seb_allowedbrowserexamkeys'] = 'Allowed browser exam keys';
$string['seb_allowedbrowserexamkeys_help'] = 'In this field you can enter the allowed browser exam keys for versions of Safe Exam Browser that are permitted to access this quiz. If no keys are entered, then browser exam keys are not checked.';
$string['seb_allowreloadinexam'] = 'Enable reload in exam';
diff --git a/mod/quiz/accessrule/seb/rule.php b/mod/quiz/accessrule/seb/rule.php
index a61d282ea26..c2f67a13963 100644
--- a/mod/quiz/accessrule/seb/rule.php
+++ b/mod/quiz/accessrule/seb/rule.php
@@ -252,6 +252,8 @@ class quizaccess_seb extends access_rule_base {
. 'seb.userconfirmquit AS seb_userconfirmquit, '
. 'seb.enableaudiocontrol AS seb_enableaudiocontrol, '
. 'seb.muteonstartup AS seb_muteonstartup, '
+ . 'seb.allowcapturecamera AS seb_allowcapturecamera, '
+ . 'seb.allowcapturemicrophone AS seb_allowcapturemicrophone, '
. 'seb.allowspellchecking AS seb_allowspellchecking, '
. 'seb.allowreloadinexam AS seb_allowreloadinexam, '
. 'seb.activateurlfiltering AS seb_activateurlfiltering, '
diff --git a/mod/quiz/accessrule/seb/tests/behat/edit_form.feature b/mod/quiz/accessrule/seb/tests/behat/edit_form.feature
index 49c87d40f1d..cc8f97aa72e 100644
--- a/mod/quiz/accessrule/seb/tests/behat/edit_form.feature
+++ b/mod/quiz/accessrule/seb/tests/behat/edit_form.feature
@@ -39,13 +39,13 @@ Feature: Safe Exam Browser settings in quiz edit form
| contextlevel | System |
| reference | |
And the following "user" exists:
- | username | teacher |
- | firstname | Teacher |
- | lastname | One |
+ | username | teacher |
+ | firstname | Teacher |
+ | lastname | One |
And the following "course enrolment" exists:
- | user | teacher |
- | course | C1 |
- | role | editingteacher |
+ | user | teacher |
+ | course | C1 |
+ | role | editingteacher |
And I log in as "teacher"
# Create the quiz.
When I add a quiz activity to course "Course 1" section "0" and I fill the form with:
@@ -81,6 +81,8 @@ Feature: Safe Exam Browser settings in quiz edit form
Then I should not see "Show Wi-Fi control"
Then I should not see "Enable audio controls"
Then I should not see "Mute on startup"
+ Then I should not see "Allow browser access to camera"
+ Then I should not see "Allow browser access to microphone"
Then I should not see "Enable spell checking"
Then I should not see "Enable URL filtering"
Then I should not see "Filter also embedded content"
@@ -113,6 +115,8 @@ Feature: Safe Exam Browser settings in quiz edit form
Then I should not see "Show Wi-Fi control"
Then I should not see "Enable audio controls"
Then I should not see "Mute on startup"
+ Then I should not see "Allow browser access to camera"
+ Then I should not see "Allow browser access to microphone"
Then I should not see "Enable spell checking"
Then I should not see "Enable URL filtering"
Then I should not see "Filter also embedded content"
@@ -143,6 +147,8 @@ Feature: Safe Exam Browser settings in quiz edit form
Then I should not see "Show Wi-Fi control"
Then I should not see "Enable audio controls"
Then I should not see "Mute on startup"
+ Then I should not see "Allow browser access to camera"
+ Then I should not see "Allow browser access to microphone"
Then I should not see "Enable spell checking"
Then I should not see "Enable URL filtering"
Then I should not see "Filter also embedded content"
@@ -177,6 +183,8 @@ Feature: Safe Exam Browser settings in quiz edit form
Then I should not see "Show Wi-Fi control"
Then I should not see "Enable audio controls"
Then I should not see "Mute on startup"
+ Then I should not see "Allow browser access to camera"
+ Then I should not see "Allow browser access to microphone"
Then I should not see "Enable spell checking"
Then I should not see "Enable URL filtering"
Then I should not see "Filter also embedded content"
@@ -207,6 +215,8 @@ Feature: Safe Exam Browser settings in quiz edit form
Then I should see "Show Wi-Fi control"
Then I should see "Enable audio controls"
Then I should not see "Mute on startup"
+ Then I should see "Allow browser access to camera"
+ Then I should see "Allow browser access to microphone"
Then I should see "Enable spell checking"
Then I should see "Enable URL filtering"
Then I should not see "Filter also embedded content"
diff --git a/mod/quiz/accessrule/seb/tests/helper_test.php b/mod/quiz/accessrule/seb/tests/helper_test.php
index 59c03f0d57d..ce327fb78ea 100644
--- a/mod/quiz/accessrule/seb/tests/helper_test.php
+++ b/mod/quiz/accessrule/seb/tests/helper_test.php
@@ -40,6 +40,7 @@ final class helper_test extends \advanced_testcase {
showTaskBarallowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterhashedQuitPassword"
. "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08URLFilterRules"
@@ -177,7 +178,8 @@ final class helper_test extends \advanced_testcase {
. "showTaskBarallowWlan"
. "showReloadButtonshowTimeshowInputLanguage"
. "allowQuitquitURLConfirmaudioControlEnabled"
- . "audioMuteallowSpellCheckbrowserWindowAllowReload"
+ . "audioMutebrowserMediaCaptureCamerabrowserMediaCaptureMicrophone"
+ . "allowSpellCheckbrowserWindowAllowReload"
. "URLFilterEnableURLFilterEnableContentFilter"
. "URLFilterRulesstartURL$url"
. "sendBrowserExamKeybrowserWindowWebView3"
diff --git a/mod/quiz/accessrule/seb/tests/quiz_settings_test.php b/mod/quiz/accessrule/seb/tests/quiz_settings_test.php
index e7bedf38e3f..e1c2dfcfbe0 100644
--- a/mod/quiz/accessrule/seb/tests/quiz_settings_test.php
+++ b/mod/quiz/accessrule/seb/tests/quiz_settings_test.php
@@ -82,6 +82,7 @@ final class quiz_settings_test extends \advanced_testcase {
showTaskBarallowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterhashedQuitPassword"
. "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08URLFilterRules"
@@ -115,6 +116,7 @@ final class quiz_settings_test extends \advanced_testcase {
showTaskBarallowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterhashedQuitPassword"
. "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08URLFilterRules"
@@ -132,6 +134,7 @@ final class quiz_settings_test extends \advanced_testcase {
showTaskBarallowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterhashedQuitPassword"
. "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08URLFilterRules"
@@ -150,7 +153,7 @@ final class quiz_settings_test extends \advanced_testcase {
$quizsettings = new seb_quiz_settings(0, $settings);
$configkey = $quizsettings->get_config_key();
- $this->assertEquals("65ff7a3b8aec80e58fbe2e7968826c33cbf0ac444a748055ebe665829cbf4201",
+ $this->assertEquals("24712dcecc69a2ca8ad19f4f8928375038f087e13ce9f504cfc4496846aaaf27",
$configkey
);
}
@@ -163,12 +166,12 @@ final class quiz_settings_test extends \advanced_testcase {
$quizsettings = new seb_quiz_settings(0, $settings);
$configkey = $quizsettings->get_config_key();
- $this->assertEquals("65ff7a3b8aec80e58fbe2e7968826c33cbf0ac444a748055ebe665829cbf4201",
+ $this->assertEquals("24712dcecc69a2ca8ad19f4f8928375038f087e13ce9f504cfc4496846aaaf27",
$configkey);
$quizsettings->set('filterembeddedcontent', 1); // Alter the settings.
$configkey = $quizsettings->get_config_key();
- $this->assertEquals("d975b8a2ec4472495a8be7c64d7c8cc960dbb62472d5e88a8847ac0e5d77e533",
+ $this->assertEquals("e2f6dc2a6ddb9bdfa7530dc8afbae996499c34a954e1c635c4fed894e47c1abc",
$configkey);
}
@@ -565,6 +568,7 @@ final class quiz_settings_test extends \advanced_testcase {
. "allowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterURLFilterRules"
. "action1active"
@@ -593,6 +597,7 @@ final class quiz_settings_test extends \advanced_testcase {
. "allowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterURLFilterRules"
. "action0active"
@@ -621,6 +626,7 @@ final class quiz_settings_test extends \advanced_testcase {
. "allowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterURLFilterRules"
. "action1active"
@@ -649,6 +655,7 @@ final class quiz_settings_test extends \advanced_testcase {
. "allowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterURLFilterRules"
. "action0active"
@@ -677,6 +684,7 @@ final class quiz_settings_test extends \advanced_testcase {
. "allowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterURLFilterRulesaction"
. "1activeexpression*"
diff --git a/mod/quiz/accessrule/seb/tests/settings_provider_test.php b/mod/quiz/accessrule/seb/tests/settings_provider_test.php
index f9d49445cd1..5a368f5a598 100644
--- a/mod/quiz/accessrule/seb/tests/settings_provider_test.php
+++ b/mod/quiz/accessrule/seb/tests/settings_provider_test.php
@@ -177,7 +177,7 @@ final class settings_provider_test extends \advanced_testcase {
public function test_hideifs(): void {
$settinghideifs = settings_provider::get_quiz_hideifs();
- $this->assertCount(23, $settinghideifs);
+ $this->assertCount(25, $settinghideifs);
$this->assertArrayHasKey('seb_templateid', $settinghideifs);
$this->assertCount(1, $settinghideifs['seb_templateid']);
@@ -362,6 +362,26 @@ final class settings_provider_test extends \advanced_testcase {
settings_provider::USE_SEB_CONFIG_MANUALLY
);
+ $this->assertArrayHasKey('seb_allowcapturecamera', $settinghideifs);
+ $this->assertCount(1, $settinghideifs['seb_allowcapturecamera']);
+ $this->assert_hide_if(
+ $settinghideifs['seb_allowcapturecamera'][0],
+ 'seb_allowcapturecamera',
+ 'seb_requiresafeexambrowser',
+ 'noteq',
+ settings_provider::USE_SEB_CONFIG_MANUALLY
+ );
+
+ $this->assertArrayHasKey('seb_allowcapturemicrophone', $settinghideifs);
+ $this->assertCount(1, $settinghideifs['seb_allowcapturemicrophone']);
+ $this->assert_hide_if(
+ $settinghideifs['seb_allowcapturemicrophone'][0],
+ 'seb_allowcapturemicrophone',
+ 'seb_requiresafeexambrowser',
+ 'noteq',
+ settings_provider::USE_SEB_CONFIG_MANUALLY
+ );
+
$this->assertArrayHasKey('seb_muteonstartup', $settinghideifs);
$this->assertCount(2, $settinghideifs['seb_muteonstartup']);
$this->assert_hide_if(
@@ -1319,6 +1339,8 @@ final class settings_provider_test extends \advanced_testcase {
$allsettings->seb_regexblocked = 20;
$allsettings->seb_templateid = 21;
$allsettings->seb_allowedbrowserexamkeys = 22;
+ $allsettings->seb_allowcapturecamera = 23;
+ $allsettings->seb_allowcapturemicrophone = 24;
return $allsettings;
}
@@ -1422,6 +1444,8 @@ final class settings_provider_test extends \advanced_testcase {
'seb_enableaudiocontrol' => [
'seb_muteonstartup' => [],
],
+ 'seb_allowcapturecamera' => [],
+ 'seb_allowcapturemicrophone' => [],
'seb_allowspellchecking' => [],
'seb_activateurlfiltering' => [
'seb_filterembeddedcontent' => [],
diff --git a/mod/quiz/accessrule/seb/tests/template_test.php b/mod/quiz/accessrule/seb/tests/template_test.php
index e8ff8f8ff37..3ad03d160a1 100644
--- a/mod/quiz/accessrule/seb/tests/template_test.php
+++ b/mod/quiz/accessrule/seb/tests/template_test.php
@@ -54,6 +54,7 @@ final class template_test extends \advanced_testcase {
showTaskBarallowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterhashedQuitPassword"
. "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08URLFilterRules"
@@ -102,6 +103,7 @@ final class template_test extends \advanced_testcase {
showTaskBarallowWlanshowReloadButton"
. "showTimeshowInputLanguageallowQuit"
. "quitURLConfirmaudioControlEnabledaudioMute"
+ . "browserMediaCaptureCamerabrowserMediaCaptureMicrophone"
. "allowSpellCheckbrowserWindowAllowReloadURLFilterEnable"
. "URLFilterEnableContentFilterhashedQuitPassword"
. "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08URLFilterRules"
@@ -129,6 +131,8 @@ final class template_test extends \advanced_testcase {
'linkquitseb' => '',
'userconfirmquit' => '1',
'enableaudiocontrol' => '1',
+ 'allowcapturecamera' => '1',
+ 'allowcapturemicrophone' => '1',
'muteonstartup' => '0',
'allowspellchecking' => '0',
'allowreloadinexam' => '1',
diff --git a/mod/quiz/accessrule/seb/tests/test_helper_trait.php b/mod/quiz/accessrule/seb/tests/test_helper_trait.php
index 40829fcd176..bf19f44d14b 100644
--- a/mod/quiz/accessrule/seb/tests/test_helper_trait.php
+++ b/mod/quiz/accessrule/seb/tests/test_helper_trait.php
@@ -300,6 +300,8 @@ trait quizaccess_seb_test_helper_trait {
'userconfirmquit' => '1',
'enableaudiocontrol' => '1',
'muteonstartup' => '0',
+ 'allowcapturecamera' => '1',
+ 'allowcapturemicrophone' => '1',
'allowspellchecking' => '0',
'allowreloadinexam' => '1',
'activateurlfiltering' => '1',
diff --git a/mod/quiz/accessrule/seb/version.php b/mod/quiz/accessrule/seb/version.php
index 1d6405c837a..73be23ac7be 100644
--- a/mod/quiz/accessrule/seb/version.php
+++ b/mod/quiz/accessrule/seb/version.php
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2024121800;
+$plugin->version = 2024121801;
$plugin->requires = 2024100100;
$plugin->component = 'quizaccess_seb';
$plugin->maturity = MATURITY_STABLE;
diff --git a/mod/quiz/backup/moodle2/restore_quiz_stepslib.php b/mod/quiz/backup/moodle2/restore_quiz_stepslib.php
index fa22cf4cf5f..9d8b5e663f3 100644
--- a/mod/quiz/backup/moodle2/restore_quiz_stepslib.php
+++ b/mod/quiz/backup/moodle2/restore_quiz_stepslib.php
@@ -301,6 +301,8 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st
$sebsettings->userconfirmquit = null;
$sebsettings->enableaudiocontrol = null;
$sebsettings->muteonstartup = null;
+ $sebsettings->allowcapturecamera = null;
+ $sebsettings->allowcapturemicrophone = null;
$sebsettings->allowspellchecking = null;
$sebsettings->allowreloadinexam = null;
$sebsettings->activateurlfiltering = null;