MDL-69645 quizaccess: Set allowPreferencesWindow to false in manual conf
authorLuca Bösch <luca.boesch@bfh.ch>
Mon, 7 Sep 2020 11:29:16 +0000 (13:29 +0200)
committerLuca Bösch <luca.boesch@bfh.ch>
Mon, 7 Sep 2020 19:26:23 +0000 (21:26 +0200)
Signed-off-by: Luca Bösch <luca.boesch@bfh.ch>
mod/quiz/accessrule/seb/classes/quiz_settings.php
mod/quiz/accessrule/seb/tests/helper_test.php
mod/quiz/accessrule/seb/tests/quiz_settings_test.php

index c621a51..cfc1b7d 100644 (file)
@@ -460,6 +460,7 @@ class quiz_settings extends persistent {
 
         // One of the requirements for USE_SEB_CONFIG_MANUALLY is setting examSessionClearCookiesOnStart to false.
         $this->plist->set_or_update_value('examSessionClearCookiesOnStart', new CFBoolean(false));
+        $this->plist->set_or_update_value('allowPreferencesWindow', new CFBoolean(false));
         $this->config = $this->plist->to_xml();
     }
 
index a034ca4..22486e4 100644 (file)
@@ -187,7 +187,7 @@ class quizaccess_seb_helper_testhelpertrait extends advanced_testcase {
             . "<true/><key>URLFilterEnable</key><false/><key>URLFilterEnableContentFilter</key><false/>"
             . "<key>URLFilterRules</key><array/><key>startURL</key><string>$url</string>"
             . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
-            . "</dict></plist>\n", $config);
+            . "<key>allowPreferencesWindow</key><false/></dict></plist>\n", $config);
     }
 
 }
index 57f0513..d01b7e5 100644 (file)
@@ -91,7 +91,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
                 . "<string>9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08</string><key>URLFilterRules</key>"
                 . "<array><dict><key>action</key><integer>1</integer><key>active</key><true/><key>expression</key>"
                 . "<string>test.com</string><key>regex</key><false/></dict></array><key>startURL</key><string>$this->url</string>"
-                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n",
+                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+                . "<key>allowPreferencesWindow</key><false/></dict></plist>\n",
             $config);
     }
 
@@ -122,7 +123,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
             . "<string>9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08</string><key>URLFilterRules</key>"
             . "<array><dict><key>action</key><integer>1</integer><key>active</key><true/><key>expression</key>"
             . "<string>test.com</string><key>regex</key><false/></dict></array><key>startURL</key><string>$this->url</string>"
-            . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n", $config);
+            . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+            . "<key>allowPreferencesWindow</key><false/></dict></plist>\n", $config);
 
         $quizsettings->set('filterembeddedcontent', 1); // Alter the settings.
         $quizsettings->save();
@@ -137,7 +139,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
             . "<string>9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08</string><key>URLFilterRules</key>"
             . "<array><dict><key>action</key><integer>1</integer><key>active</key><true/><key>expression</key>"
             . "<string>test.com</string><key>regex</key><false/></dict></array><key>startURL</key><string>$this->url</string>"
-            . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n", $config);
+            . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+            . "<key>allowPreferencesWindow</key><false/></dict></plist>\n", $config);
     }
 
     /**
@@ -148,7 +151,7 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
 
         $quizsettings = new quiz_settings(0, $settings);
         $configkey = $quizsettings->get_config_key();
-        $this->assertEquals("89557366c34cb64a33781e1fb767cb15380731efdfb967e037476ef420f1d7b8",
+        $this->assertEquals("b35510bd754f9d106ff88b9d2dc1bb297cddc9fc7b4bdde2dbda4e7d9e4b50d8",
             $configkey
         );
     }
@@ -161,12 +164,12 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
 
         $quizsettings = new quiz_settings(0, $settings);
         $configkey = $quizsettings->get_config_key();
-        $this->assertEquals("89557366c34cb64a33781e1fb767cb15380731efdfb967e037476ef420f1d7b8",
+        $this->assertEquals("b35510bd754f9d106ff88b9d2dc1bb297cddc9fc7b4bdde2dbda4e7d9e4b50d8",
                 $configkey);
 
         $quizsettings->set('filterembeddedcontent', 1); // Alter the settings.
         $configkey = $quizsettings->get_config_key();
-        $this->assertEquals("4476e7fc1e4e769c930685535b0f6377e6f736cd6c24b68db512455a95f028b5",
+        $this->assertEquals("58010792504cccc18f7b0e5c9680fe60b567e8c1b5fb9798654cc9bad9ddf30c",
             $configkey);
     }
 
@@ -571,7 +574,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
                 . "<key>active</key><true/><key>expression</key>"
                 . "<string>second.hello</string><key>regex</key><false/></dict></array>"
                 . "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id=1</string>"
-                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n",
+                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+                . "<key>allowPreferencesWindow</key><false/></dict></plist>\n",
             ],
             'blocked simple expessions' => [
                 (object) [
@@ -597,7 +601,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
                 . "<key>active</key><true/><key>expression</key>"
                 . "<string>second.hello</string><key>regex</key><false/></dict></array>"
                 . "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id=1</string>"
-                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n",
+                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+                . "<key>allowPreferencesWindow</key><false/></dict></plist>\n",
             ],
             'enabled regex expessions' => [
                 (object) [
@@ -623,7 +628,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
                 . "<key>active</key><true/><key>expression</key>"
                 . "<string>second.hello</string><key>regex</key><true/></dict></array>"
                 . "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id=1</string>"
-                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n",
+                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+                . "<key>allowPreferencesWindow</key><false/></dict></plist>\n",
             ],
             'blocked regex expessions' => [
                 (object) [
@@ -649,7 +655,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
                 . "<key>active</key><true/><key>expression</key>"
                 . "<string>second.hello</string><key>regex</key><true/></dict></array>"
                 . "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id=1</string>"
-                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n",
+                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+                . "<key>allowPreferencesWindow</key><false/></dict></plist>\n",
             ],
             'multiple simple expessions' => [
                 (object) [
@@ -677,7 +684,8 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase {
                 . "<key>active</key><true/><key>expression</key>"
                 . "<string>second.hello</string><key>regex</key><true/></dict></array>"
                 . "<key>startURL</key><string>https://www.example.com/moodle/mod/quiz/view.php?id=1</string>"
-                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/></dict></plist>\n",
+                . "<key>sendBrowserExamKey</key><true/><key>examSessionClearCookiesOnStart</key><false/>"
+                . "<key>allowPreferencesWindow</key><false/></dict></plist>\n",
             ],
         ];
     }