Skip to content

Commit

Permalink
MDL-67850 quizaccess: remove the old quizaccess_safebrowser
Browse files Browse the repository at this point in the history
Co-authored-by: Nicholas Hoobin <nicholashoobin@catalyst-au.net>
Co-authored-by: Andrew Madden <andrewmadden@catalyst-au.net>
  • Loading branch information
3 people committed Apr 29, 2020
1 parent 79f6212 commit 78adf6f
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 274 deletions.
1 change: 0 additions & 1 deletion admin/settings/development.php
Expand Up @@ -10,7 +10,6 @@
$temp = new admin_settingpage('experimentalsettings', new lang_string('experimentalsettings', 'admin'));
//TODO: Re-enable cc-import once re-implemented in 2.0.x
//$temp->add(new admin_setting_configcheckbox('enableimsccimport', new lang_string('enable_cc_import', 'imscc'), new lang_string('enable_cc_import_description', 'imscc'), 0));
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', new lang_string('enablesafebrowserintegration', 'admin'), new lang_string('configenablesafebrowserintegration', 'admin'), 0));

$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));

Expand Down
2 changes: 0 additions & 2 deletions lang/en/admin.php
Expand Up @@ -236,7 +236,6 @@
$string['configenablerssfeeds'] = 'If enabled, RSS feeds are generated by various features across the site, such as blogs, forums, database activities and glossaries. Note that RSS feeds also need to be enabled for the particular activity modules.';
$string['configenablerssfeedsdisabled'] = 'It is not available because RSS feeds are disabled in all the Site. To enable them, go to the Variables settings under Admin Configuration.';
$string['configenablerssfeedsdisabled2'] = 'RSS feeds are currently disabled at site level. They may be enabled in Advanced features in the Site administration.';
$string['configenablesafebrowserintegration'] = 'This adds the choice \'Require Safe Exam Browser\' to the \'Browser security\' field on the quiz settings form. See https://www.safeexambrowser.org/ for more information.';
$string['configenablestats'] = 'If you choose \'yes\' here, Moodle\'s cronjob will process the logs and gather some statistics. Depending on the amount of traffic on your site, this can take awhile. If you enable this, you will be able to see some interesting graphs and statistics about each of your courses, or on a sitewide basis.';
$string['configenabletrusttext'] = 'By default Moodle will always thoroughly clean text that comes from users to remove any possible bad scripts, media etc that could be a security risk. The Trusted Content system is a way of giving particular users that you trust the ability to include these advanced features in their content without interference. To enable this system, you need to first enable this setting, and then grant the Trusted Content permission to a specific Moodle role. Texts created or uploaded by such users will be marked as trusted and will not be cleaned before display.';
$string['configenablewebservices'] = 'Web services enable other systems, such as the Moodle app, to log in to the site and perform operations. For extra security, the setting should be disabled if you are not using the app, or an external tool/service that requires integration via web services.';
Expand Down Expand Up @@ -545,7 +544,6 @@
$string['enablemoodlenet_desc'] = 'If enabled, and provided the MoodleNet plugin is installed, users can import content from MoodleNet into this site.';
$string['enablerecordcache'] = 'Enable record cache';
$string['enablerssfeeds'] = 'Enable RSS feeds';
$string['enablesafebrowserintegration'] = 'Enable Safe Exam Browser integration';
$string['enablesearchareas'] = 'Enable search areas';
$string['enablestats'] = 'Enable statistics';
$string['enabletrusttext'] = 'Enable trusted content';
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/plugin_manager.php
Expand Up @@ -1960,7 +1960,7 @@ public static function standard_plugins_list($type) {

'quizaccess' => array(
'delaybetweenattempts', 'ipaddress', 'numattempts', 'offlineattempts', 'openclosedate',
'password', 'safebrowser', 'securewindow', 'timelimit'
'password', 'seb', 'securewindow', 'timelimit'
),

'report' => array(
Expand Down
8 changes: 8 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -2306,5 +2306,13 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2020041700.01);
}

if ($oldversion < 2020042800.01) {
// Delete obsolete config value.
unset_config('enablesafebrowserintegration');
// Clean up config of the old plugin.
unset_all_config_for_plugin('quizaccess_safebrowser');

upgrade_main_savepoint(true, 2020042800.01);
}
return true;
}
2 changes: 2 additions & 0 deletions lib/upgrade.txt
Expand Up @@ -2,6 +2,8 @@ This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.

=== 3.9 ===
* Old Safe Exam Browser quiz access rule (quizaccess_safebrowser) replaced by new Safe Exam Browser access rule (quizaccess_seb).
Experimental setting enablesafebrowserintegration was deleted.
* New CFPropertyList library has been added to Moodle core in /lib/plist.
* behat_data_generators::the_following_exist() has been removed, please use
behat_data_generators::the_following_entities_exist() instead. See MDL-67691 for more info.
Expand Down
46 changes: 0 additions & 46 deletions mod/quiz/accessrule/safebrowser/classes/privacy/provider.php

This file was deleted.

34 changes: 0 additions & 34 deletions mod/quiz/accessrule/safebrowser/lang/en/quizaccess_safebrowser.php

This file was deleted.

92 changes: 0 additions & 92 deletions mod/quiz/accessrule/safebrowser/rule.php

This file was deleted.

63 changes: 0 additions & 63 deletions mod/quiz/accessrule/safebrowser/tests/rule_test.php

This file was deleted.

32 changes: 0 additions & 32 deletions mod/quiz/accessrule/safebrowser/version.php

This file was deleted.

46 changes: 44 additions & 2 deletions mod/quiz/backup/moodle2/restore_quiz_stepslib.php
Expand Up @@ -97,7 +97,7 @@ protected function define_structure() {
}

protected function process_quiz($data) {
global $CFG, $DB;
global $CFG, $DB, $USER;

$data = (object)$data;
$oldid = $data->id;
Expand Down Expand Up @@ -231,11 +231,17 @@ protected function process_quiz($data) {
} else if ($data->popup == 1) {
$data->browsersecurity = 'securewindow';
} else if ($data->popup == 2) {
$data->browsersecurity = 'safebrowser';
// Since 3.9 quizaccess_safebrowser replaced with a new quizaccess_seb.
$data->browsersecurity = '-';
$addsebrule = true;
} else {
$data->preferredbehaviour = '-';
}
unset($data->popup);
} else if ($data->browsersecurity == 'safebrowser') {
// Since 3.9 quizaccess_safebrowser replaced with a new quizaccess_seb.
$data->browsersecurity = '-';
$addsebrule = true;
}

if (!isset($data->overduehandling)) {
Expand All @@ -250,6 +256,42 @@ protected function process_quiz($data) {
$newitemid = $DB->insert_record('quiz', $data);
// Immediately after inserting "activity" record, call this.
$this->apply_activity_instance($newitemid);

// Process Safe Exam Browser settings for backups taken in Moodle < 3.9.
if (!empty($addsebrule)) {
$sebsettings = new stdClass();

$sebsettings->quizid = $newitemid;
$sebsettings->cmid = $this->task->get_moduleid();
$sebsettings->templateid = 0;
$sebsettings->requiresafeexambrowser = \quizaccess_seb\settings_provider::USE_SEB_CLIENT_CONFIG;
$sebsettings->showsebtaskbar = null;
$sebsettings->showwificontrol = null;
$sebsettings->showreloadbutton = null;
$sebsettings->showtime = null;
$sebsettings->showkeyboardlayout = null;
$sebsettings->allowuserquitseb = null;
$sebsettings->quitpassword = null;
$sebsettings->linkquitseb = null;
$sebsettings->userconfirmquit = null;
$sebsettings->enableaudiocontrol = null;
$sebsettings->muteonstartup = null;
$sebsettings->allowspellchecking = null;
$sebsettings->allowreloadinexam = null;
$sebsettings->activateurlfiltering = null;
$sebsettings->filterembeddedcontent = null;
$sebsettings->expressionsallowed = null;
$sebsettings->regexallowed = null;
$sebsettings->expressionsblocked = null;
$sebsettings->regexblocked = null;
$sebsettings->allowedbrowserexamkeys = null;
$sebsettings->showsebdownloadlink = 1;
$sebsettings->usermodified = $USER->id;
$sebsettings->timecreated = time();
$sebsettings->timemodified = time();

$DB->insert_record('quizaccess_seb_quizsettings', $sebsettings);
}
}

protected function process_quiz_question_instance($data) {
Expand Down

0 comments on commit 78adf6f

Please sign in to comment.