diff --git a/admin/modules.php b/admin/modules.php index 1ec117e82e5..3a17cf5b780 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -38,11 +38,22 @@ } if (!empty($show) and confirm_sesskey()) { - $class = \core_plugin_manager::resolve_plugininfo_class('mod'); - $class::enable_plugin($show, true); + $canenablemodule = true; + $modulename = $show; - admin_get_root(true, false); // settings not required - only pages - redirect(new moodle_url('/admin/modules.php')); + // Invoking a callback function that enables plugins to force additional actions (e.g. displaying notifications, + // modals, etc.) and also specify through its returned value (bool) whether the process of enabling the plugin + // should continue after these actions or not. + if (component_callback_exists("mod_{$modulename}", 'pre_enable_plugin_actions')) { + $canenablemodule = component_callback("mod_{$modulename}", 'pre_enable_plugin_actions'); + } + + if ($canenablemodule) { + $class = \core_plugin_manager::resolve_plugininfo_class('mod'); + $class::enable_plugin($show, true); + admin_get_root(true, false); // Settings not required - only pages. + redirect(new moodle_url('/admin/modules.php')); + } } echo $OUTPUT->header(); diff --git a/admin/upgrade.txt b/admin/upgrade.txt index 6beeb3a0f42..df789ff29b9 100644 --- a/admin/upgrade.txt +++ b/admin/upgrade.txt @@ -1,5 +1,12 @@ This files describes API changes in /admin/*. +=== 4.0.1 === + +* A new callback xxx_pre_enable_plugin_actions has been added in admin/modules.php. Plugins can use this callback to + force additional actions (e.g. displaying notifications, modals, etc.) before enabling the plugin. The expected + return value (bool) from the plugin callback method specifies whether the process of enabling the plugin should + continue after the added actions or not. + === 3.11 === * New admin setting admin_setting_encryptedpassword allows passwords in admin settings to be diff --git a/course/lib.php b/course/lib.php index 46668cecd28..37c89ebc3e4 100644 --- a/course/lib.php +++ b/course/lib.php @@ -391,12 +391,13 @@ function course_integrity_check($courseid, $rawmods = null, $sections = null, $f * and the value is a lang_string object with a human-readable string. * * @param bool $plural If true, the function returns the plural forms of the names. + * @param bool $resetcache If true, the static cache will be reset * @return lang_string[] Localised human-readable names of all used modules. */ -function get_module_types_names($plural = false) { +function get_module_types_names($plural = false, $resetcache = false) { static $modnames = null; global $DB, $CFG; - if ($modnames === null) { + if ($modnames === null || $resetcache) { $modnames = array(0 => array(), 1 => array()); if ($allmods = $DB->get_records("modules")) { foreach ($allmods as $mod) { diff --git a/mod/bigbluebuttonbn/amd/build/accept_dpa.min.js b/mod/bigbluebuttonbn/amd/build/accept_dpa.min.js new file mode 100644 index 00000000000..52b5e8e4020 --- /dev/null +++ b/mod/bigbluebuttonbn/amd/build/accept_dpa.min.js @@ -0,0 +1,11 @@ +define("mod_bigbluebuttonbn/accept_dpa",["exports","core_form/modalform","core/notification","core/str"],(function(_exports,_modalform,_notification,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} +/** + * Javascript module for confirming the acceptance of the current data processing agreement before enabling + * the BigBlueButton activity module. + * + * @module mod_bigbluebuttonbn/accept_dpa + * @copyright 2022 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modalform=_interopRequireDefault(_modalform),_notification=_interopRequireDefault(_notification);_exports.init=()=>{const modalForm=new _modalform.default({modalConfig:{title:(0,_str.get_string)("enablingbigbluebutton","mod_bigbluebuttonbn"),large:!1},formClass:"mod_bigbluebuttonbn\\form\\accept_dpa",saveButtonText:(0,_str.get_string)("enable")});modalForm.addEventListener(modalForm.events.FORM_SUBMITTED,(event=>{event.detail.result?window.location.reload():_notification.default.addNotification({type:"error",message:event.detail.errors.join("
")})})),modalForm.show()}})); + +//# sourceMappingURL=accept_dpa.min.js.map \ No newline at end of file diff --git a/mod/bigbluebuttonbn/amd/build/accept_dpa.min.js.map b/mod/bigbluebuttonbn/amd/build/accept_dpa.min.js.map new file mode 100644 index 00000000000..59c6d74dd45 --- /dev/null +++ b/mod/bigbluebuttonbn/amd/build/accept_dpa.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"accept_dpa.min.js","sources":["../src/accept_dpa.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Javascript module for confirming the acceptance of the current data processing agreement before enabling\n * the BigBlueButton activity module.\n *\n * @module mod_bigbluebuttonbn/accept_dpa\n * @copyright 2022 Mihail Geshoski \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalForm from 'core_form/modalform';\nimport Notification from 'core/notification';\nimport {get_string as getString} from 'core/str';\n\n/**\n * Initialize module.\n */\nexport const init = () => {\n\n const modalForm = new ModalForm({\n modalConfig: {\n title: getString('enablingbigbluebutton', 'mod_bigbluebuttonbn'),\n large: false,\n },\n formClass: 'mod_bigbluebuttonbn\\\\form\\\\accept_dpa',\n saveButtonText: getString('enable'),\n });\n\n // Once the form has been submitted and successfully processed, reload the page to enable the activity module.\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {\n if (event.detail.result) {\n window.location.reload();\n } else {\n Notification.addNotification({\n type: 'error',\n message: event.detail.errors.join('
')\n });\n }\n });\n\n modalForm.show();\n};\n"],"names":["modalForm","ModalForm","modalConfig","title","large","formClass","saveButtonText","addEventListener","events","FORM_SUBMITTED","event","detail","result","window","location","reload","addNotification","type","message","errors","join","show"],"mappings":";;;;;;;;kMA+BoB,WAEVA,UAAY,IAAIC,mBAAU,CAC5BC,YAAa,CACTC,OAAO,mBAAU,wBAAyB,uBAC1CC,OAAO,GAEXC,UAAW,wCACXC,gBAAgB,mBAAU,YAI9BN,UAAUO,iBAAiBP,UAAUQ,OAAOC,gBAAgBC,QACpDA,MAAMC,OAAOC,OACbC,OAAOC,SAASC,+BAEHC,gBAAgB,CACzBC,KAAM,QACNC,QAAUR,MAAMC,OAAOQ,OAAOC,KAAK,aAK/CpB,UAAUqB"} \ No newline at end of file diff --git a/mod/bigbluebuttonbn/amd/src/accept_dpa.js b/mod/bigbluebuttonbn/amd/src/accept_dpa.js new file mode 100644 index 00000000000..4fd5fc868cd --- /dev/null +++ b/mod/bigbluebuttonbn/amd/src/accept_dpa.js @@ -0,0 +1,56 @@ +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * Javascript module for confirming the acceptance of the current data processing agreement before enabling + * the BigBlueButton activity module. + * + * @module mod_bigbluebuttonbn/accept_dpa + * @copyright 2022 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +import ModalForm from 'core_form/modalform'; +import Notification from 'core/notification'; +import {get_string as getString} from 'core/str'; + +/** + * Initialize module. + */ +export const init = () => { + + const modalForm = new ModalForm({ + modalConfig: { + title: getString('enablingbigbluebutton', 'mod_bigbluebuttonbn'), + large: false, + }, + formClass: 'mod_bigbluebuttonbn\\form\\accept_dpa', + saveButtonText: getString('enable'), + }); + + // Once the form has been submitted and successfully processed, reload the page to enable the activity module. + modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => { + if (event.detail.result) { + window.location.reload(); + } else { + Notification.addNotification({ + type: 'error', + message: event.detail.errors.join('
') + }); + } + }); + + modalForm.show(); +}; diff --git a/mod/bigbluebuttonbn/classes/form/accept_dpa.php b/mod/bigbluebuttonbn/classes/form/accept_dpa.php new file mode 100644 index 00000000000..9caf1cf3646 --- /dev/null +++ b/mod/bigbluebuttonbn/classes/form/accept_dpa.php @@ -0,0 +1,104 @@ +. + +namespace mod_bigbluebuttonbn\form; + +use context; +use moodle_exception; +use moodle_url; +use core_form\dynamic_form; +use mod_bigbluebuttonbn\local\config; + +/** + * Accept data processing agreement form presented before enabling the BigBlueButton activity module. + * + * @package mod_bigbluebuttonbn + * @copyright 2022 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class accept_dpa extends dynamic_form { + + /** + * Form definition + */ + protected function definition() { + $this->_form->addElement('html', \html_writer::tag('p', + get_string('enablingbigbluebuttondpainfo', 'mod_bigbluebuttonbn', config::DEFAULT_DPA_URL))); + $this->_form->addElement('checkbox', 'acceptdefaultdpa', false, get_string('acceptdpa', 'mod_bigbluebuttonbn'), + ['class' => 'bold']); + $this->_form->addRule('acceptdefaultdpa', get_string('required'), 'required', null, 'client'); + } + + /** + * Return form context + * + * @return context + */ + protected function get_context_for_dynamic_submission(): context { + return \context_system::instance(); + } + + /** + * Check if current user has access to this form, otherwise throw exception. + * + * @return void + * @throws moodle_exception + */ + protected function check_access_for_dynamic_submission(): void { + require_capability('moodle/site:config', $this->get_context_for_dynamic_submission()); + } + + /** + * Process the form submission, used if form was submitted via AJAX. + * + * @return array + */ + public function process_dynamic_submission(): array { + $result = false; + $errors = []; + + if ($this->get_data()->acceptdefaultdpa) { + try { + set_config('bigbluebuttonbn_default_dpa_accepted', true); + $result = true; + } catch (\Exception $e) { + $errors[] = $e->getMessage(); + } + } + + return [ + 'result' => $result, + 'errors' => $errors, + ]; + } + + /** + * Load in existing data as form defaults (not applicable). + * + * @return void + */ + public function set_data_for_dynamic_submission(): void { + } + + /** + * Returns url to set in $PAGE->set_url() when form is being rendered or submitted via AJAX. + * + * @return moodle_url + */ + protected function get_page_url_for_dynamic_submission(): moodle_url { + return new moodle_url('/admin/modules.php', ['show' => 'bigbluebuttonbn', 'sesskey' => sesskey()]); + } +} diff --git a/mod/bigbluebuttonbn/classes/local/config.php b/mod/bigbluebuttonbn/classes/local/config.php index 1dc42507534..0c74c8d2cfa 100644 --- a/mod/bigbluebuttonbn/classes/local/config.php +++ b/mod/bigbluebuttonbn/classes/local/config.php @@ -35,6 +35,9 @@ class config { /** @var string Default bigbluebutton server shared secret */ public const DEFAULT_SHARED_SECRET = '0b21fcaf34673a8c3ec8ed877d76ae34'; + /** @var string Default bigbluebutton data processing agreement url */ + public const DEFAULT_DPA_URL = 'https://blindsidenetworks.com/dpa-moodle-free-tier'; + /** * Returns moodle version. * @@ -108,6 +111,7 @@ class config { 'lockonjoin_default' => true, 'lockonjoin_editable' => false, 'welcome_default' => '', + 'default_dpa_accepted' => false, ]; } diff --git a/mod/bigbluebuttonbn/classes/settings.php b/mod/bigbluebuttonbn/classes/settings.php index 8a2e269d208..d1a6d9426bc 100644 --- a/mod/bigbluebuttonbn/classes/settings.php +++ b/mod/bigbluebuttonbn/classes/settings.php @@ -174,6 +174,16 @@ class settings { $item, $settingsgeneral ); + $item = new \admin_setting_description( + 'bigbluebuttonbn_dpa_info', + '', + get_string('config_dpa_note', 'bigbluebuttonbn', config::DEFAULT_DPA_URL), + ); + $this->add_conditional_element( + 'dpa_info', + $item, + $settingsgeneral + ); $settingsgeneral->add($item); $item = new admin_setting_heading( 'bigbluebuttonbn_config_default_messages', diff --git a/mod/bigbluebuttonbn/classes/task/send_bigbluebutton_module_disabled_notification.php b/mod/bigbluebuttonbn/classes/task/send_bigbluebutton_module_disabled_notification.php new file mode 100644 index 00000000000..0da79bad316 --- /dev/null +++ b/mod/bigbluebuttonbn/classes/task/send_bigbluebutton_module_disabled_notification.php @@ -0,0 +1,58 @@ +. + +declare(strict_types=1); + +namespace mod_bigbluebuttonbn\task; + +use core\task\adhoc_task; +use core\message\message; +use mod_bigbluebuttonbn\local\config; + +/** + * Ad-hoc task to send a notification related to the disabling of the BigBlueButton activity module. + * + * The ad-hoc tasks sends a notification to the administrator informing that the BigBlueButton activity module has + * been disabled and they are required to confirm their acceptance of the data processing agreement prior to + * re-enabling it. + * + * @package mod_bigbluebuttonbn + * @copyright 2022 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class send_bigbluebutton_module_disabled_notification extends adhoc_task { + + /** + * Execute the task. + */ + public function execute(): void { + $message = new message(); + $message->component = 'moodle'; + $message->name = 'notices'; + $message->userfrom = \core_user::get_noreply_user(); + $message->userto = get_admin(); + $message->notification = 1; + $message->contexturl = (new \moodle_url('/admin/modules.php'))->out(false); + $message->contexturlname = get_string('modsettings', 'admin'); + $message->subject = get_string('bigbluebuttondisablednotification_subject', 'mod_bigbluebuttonbn'); + $message->fullmessageformat = FORMAT_HTML; + $message->fullmessagehtml = get_string('bigbluebuttondisablednotification', 'mod_bigbluebuttonbn', + config::DEFAULT_DPA_URL); + $message->smallmessage = strip_tags($message->fullmessagehtml); + + message_send($message); + } +} diff --git a/mod/bigbluebuttonbn/classes/test/testcase_helper_trait.php b/mod/bigbluebuttonbn/classes/test/testcase_helper_trait.php index df763972cef..b94eea7c43d 100644 --- a/mod/bigbluebuttonbn/classes/test/testcase_helper_trait.php +++ b/mod/bigbluebuttonbn/classes/test/testcase_helper_trait.php @@ -30,6 +30,7 @@ use mod_bigbluebuttonbn\local\proxy\recording_proxy; use mod_bigbluebuttonbn\meeting; use stdClass; use testing_data_generator; +use core\plugininfo\mod; trait testcase_helper_trait { /** @var testing_data_generator|null */ @@ -47,6 +48,12 @@ trait testcase_helper_trait { * @return array($context, $cm, $instance) Testable wrapper around the assign class. */ protected function create_instance(?stdClass $course = null, array $params = [], array $options = []): array { + // Prior to creating the instance, make sure that the BigBlueButton module is enabled. + $modules = \core_plugin_manager::instance()->get_plugins_of_type('mod'); + if (!$modules['bigbluebuttonbn']->is_enabled()) { + mod::enable_plugin('bigbluebuttonbn', true); + } + if (!$course) { $course = $this->get_course(); } diff --git a/mod/bigbluebuttonbn/db/install.php b/mod/bigbluebuttonbn/db/install.php new file mode 100644 index 00000000000..a1a22e1f51b --- /dev/null +++ b/mod/bigbluebuttonbn/db/install.php @@ -0,0 +1,33 @@ +. + +/** + * Install script for mod_bigbluebuttonbn. + * + * @package mod_bigbluebuttonbn + * @copyright 2022 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Perform the post-install procedures. + */ +function xmldb_bigbluebuttonbn_install() { + global $DB; + + // Disable the BigBlueButton activity module on new installs by default. + $DB->set_field('modules', 'visible', 0, ['name' => 'bigbluebuttonbn']); +} diff --git a/mod/bigbluebuttonbn/db/upgrade.php b/mod/bigbluebuttonbn/db/upgrade.php index c51e7fff2e5..f7d11ef95dd 100644 --- a/mod/bigbluebuttonbn/db/upgrade.php +++ b/mod/bigbluebuttonbn/db/upgrade.php @@ -418,6 +418,26 @@ function xmldb_bigbluebuttonbn_upgrade($oldversion = 0) { // Automatically generated Moodle v4.0.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2022041901) { + + set_config('bigbluebuttonbn_default_dpa_accepted', false); + + // If the default server configuration is used. + if (config::get('server_url') === config::DEFAULT_SERVER_URL) { + // Disable the BigBlueButton activity module. + $DB->set_field('modules', 'visible', 0, ['name' => 'bigbluebuttonbn']); + + // Use an adhoc task to send a notification to inform the admin that the BigBlueButton activity module + // has been disabled and they are required to confirm their acceptance of the data processing agreement + // prior to re-enabling it. + $notificationtask = new mod_bigbluebuttonbn\task\send_bigbluebutton_module_disabled_notification(); + core\task\manager::queue_adhoc_task($notificationtask); + } + + // Bigbluebuttonbn savepoint reached. + upgrade_mod_savepoint(true, 2022041901, 'bigbluebuttonbn'); + } + return true; } diff --git a/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php b/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php index fd5db7e8282..2d224634c25 100644 --- a/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php +++ b/mod/bigbluebuttonbn/lang/en/bigbluebuttonbn.php @@ -26,6 +26,7 @@ defined('MOODLE_INTERNAL') || die(); $string['activityoverview'] = 'You have upcoming BigBlueButton sessions'; +$string['acceptdpa'] = 'I understand and accept the data processing agreement'; $string['bbbduetimeoverstartingtime'] = 'The close time must be later than the open time.'; $string['bbbdurationwarning'] = 'The maximum duration for this session is %duration% minutes.'; $string['bbbrecordwarning'] = 'This session may be recorded.'; @@ -43,7 +44,12 @@ $string['bigbluebuttonbn:unprotectrecordings'] = 'Unprotect recordings'; $string['bigbluebuttonbn:deleterecordings'] = 'Delete recordings'; $string['bigbluebuttonbn:importrecordings'] = 'Import recordings'; $string['bigbluebuttonbn'] = 'BigBlueButton'; +$string['bigbluebuttondisablednotification_subject'] = 'BigBlueButton activity module disabled.'; +$string['bigbluebuttondisablednotification'] = 'The BigBlueButton activity module has been disabled and any existing BigBlueButton course activities are currently not accessible. Prior to re-enabling this plugin, please ensure that you have read and accepted the data processing agreement with Blindside Networks Inc.'; $string['cannotperformaction'] = 'Cannot perform action {$a} on this recording'; +$string['enablingbigbluebutton'] = 'Enabling BigBlueButton activity'; +$string['enablingbigbluebuttondpainfo'] = 'In order to meet your data protection obligations, prior to enabling this plugin, you may need to ensure that you have read and accepted the data processing agreement with Blindside Networks Inc.
+Please consult with your own privacy professionals for advice.'; $string['indicator:cognitivedepth'] = 'BigBlueButton cognitive'; $string['indicator:cognitivedepth_help'] = 'This indicator is based on the cognitive depth reached by the student in a BigBlueButton activity.'; $string['indicator:socialbreadth'] = 'BigBlueButton social'; @@ -124,6 +130,9 @@ $string['sendnotification'] = 'Send notification'; $string['minute'] = 'minute'; $string['minutes'] = 'minutes'; +$string['config_dpa_note'] = 'Note: In order to meet your data protection obligations, prior to using a service provider for this plugin, you may need to ensure that you have read and accepted the service provider\'s data processing agreement. +For the default free BigBlueButton service provided by Blindside Networks Inc., please read and accept the following data processing agreement.
+Please consult with your own privacy professionals for advice.'; $string['config_general'] = 'General settings'; $string['config_general_description'] = 'These settings are always used.'; $string['config_server_url'] = 'BigBlueButton server URL'; diff --git a/mod/bigbluebuttonbn/lib.php b/mod/bigbluebuttonbn/lib.php index 3eaf1ece371..00c25cd3d26 100644 --- a/mod/bigbluebuttonbn/lib.php +++ b/mod/bigbluebuttonbn/lib.php @@ -36,6 +36,7 @@ use mod_bigbluebuttonbn\local\helpers\reset; use mod_bigbluebuttonbn\logger; use mod_bigbluebuttonbn\meeting; use mod_bigbluebuttonbn\recording; +use mod_bigbluebuttonbn\local\config; global $CFG; @@ -691,3 +692,22 @@ function bigbluebuttonbn_print_recent_activity(object $course, bool $viewfullnam } return true; } + +/** + * Callback method executed prior to enabling the activity module. + * + * @return bool Whether to proceed and enable the plugin or not. + */ +function bigbluebuttonbn_pre_enable_plugin_actions(): bool { + global $PAGE; + + // If the default server configuration is used and the administrator has not accepted the default data processing + // agreement, do not enable the plugin. Instead, display a dynamic form where the administrator can confirm that he + // accepts the DPA prior to enabling the plugin. + if (config::get('server_url') === config::DEFAULT_SERVER_URL && !config::get('default_dpa_accepted')) { + $PAGE->requires->js_call_amd('mod_bigbluebuttonbn/accept_dpa', 'init', []); + return false; + } + // Otherwise, continue and enable the plugin. + return true; +} diff --git a/mod/bigbluebuttonbn/tests/behat/add_instance.feature b/mod/bigbluebuttonbn/tests/behat/add_instance.feature index 9aaf7767339..c77feb76c15 100644 --- a/mod/bigbluebuttonbn/tests/behat/add_instance.feature +++ b/mod/bigbluebuttonbn/tests/behat/add_instance.feature @@ -6,6 +6,7 @@ Feature: bigbluebuttonbn instance Background: Make sure that a course is created Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin And the following "courses" exist: | fullname | shortname | category | | Test course | Test course | 0 | diff --git a/mod/bigbluebuttonbn/tests/behat/edit_instance.feature b/mod/bigbluebuttonbn/tests/behat/edit_instance.feature index 8777403a8bf..0b1f58cd69c 100644 --- a/mod/bigbluebuttonbn/tests/behat/edit_instance.feature +++ b/mod/bigbluebuttonbn/tests/behat/edit_instance.feature @@ -4,6 +4,7 @@ When a bibluebutton instance has been created I can edit it Background: Make sure that a course is created Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin And the following config values are set as admin: | bigbluebuttonbn_voicebridge_editable | 1 | And the following "courses" exist: diff --git a/mod/bigbluebuttonbn/tests/behat/end_meeting.feature b/mod/bigbluebuttonbn/tests/behat/end_meeting.feature index 28a1324b09d..7a6d91a5db3 100644 --- a/mod/bigbluebuttonbn/tests/behat/end_meeting.feature +++ b/mod/bigbluebuttonbn/tests/behat/end_meeting.feature @@ -6,6 +6,7 @@ Feature: Test the ability to end a meeting Background: Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin Scenario Outline: Only a BigBlueButton moderator can end a session Given the following course exists: diff --git a/mod/bigbluebuttonbn/tests/behat/group_mode.feature b/mod/bigbluebuttonbn/tests/behat/group_mode.feature index 7ce985a9615..db29b385587 100644 --- a/mod/bigbluebuttonbn/tests/behat/group_mode.feature +++ b/mod/bigbluebuttonbn/tests/behat/group_mode.feature @@ -5,6 +5,7 @@ Feature: Test the module in group mode. # groupmode 1 = separate groups, we force the group # groupmode 2 = visible group Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin And the following "courses" exist: | fullname | shortname | category | groupmode | groupmodeforce | | Test Course 1 | C1 | 0 | 1 | 1 | diff --git a/mod/bigbluebuttonbn/tests/behat/join_meeting.feature b/mod/bigbluebuttonbn/tests/behat/join_meeting.feature index 02aac8301e2..8516ed1ec17 100644 --- a/mod/bigbluebuttonbn/tests/behat/join_meeting.feature +++ b/mod/bigbluebuttonbn/tests/behat/join_meeting.feature @@ -4,6 +4,7 @@ Feature: Test the ability to run the full meeting lifecycle (start to end) Background: Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin Scenario: Users should be able to join a meeting then end the meeting for themselves and return to the meeting page to join again. diff --git a/mod/bigbluebuttonbn/tests/behat/lock_settings.feature b/mod/bigbluebuttonbn/tests/behat/lock_settings.feature index 8b109ec6821..c44debe920b 100644 --- a/mod/bigbluebuttonbn/tests/behat/lock_settings.feature +++ b/mod/bigbluebuttonbn/tests/behat/lock_settings.feature @@ -6,6 +6,7 @@ Feature: Test that the meeting has the right lock setting. Background: Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin @javascript Scenario Outline: Teacher should be able to set the right lock feature in a given meeting diff --git a/mod/bigbluebuttonbn/tests/behat/meeting_roles.feature b/mod/bigbluebuttonbn/tests/behat/meeting_roles.feature index 3a5ba0f3c33..22ef21354c6 100644 --- a/mod/bigbluebuttonbn/tests/behat/meeting_roles.feature +++ b/mod/bigbluebuttonbn/tests/behat/meeting_roles.feature @@ -6,6 +6,7 @@ Feature: Test that meeting roles are sent to the server Background: Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin @javascript Scenario Outline: Users should receive the appropriate role when joining the meeting diff --git a/mod/bigbluebuttonbn/tests/behat/recordings.feature b/mod/bigbluebuttonbn/tests/behat/recordings.feature index 766543dc1c2..fc182bd2e92 100644 --- a/mod/bigbluebuttonbn/tests/behat/recordings.feature +++ b/mod/bigbluebuttonbn/tests/behat/recordings.feature @@ -4,6 +4,7 @@ Feature: The recording can be managed through the room page Background: Make sure that import recording is enabled and course, activities and recording exists Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin And the following "courses" exist: | fullname | shortname | category | | Test Course 1 | C1 | 0 | diff --git a/mod/bigbluebuttonbn/tests/behat/recordings_import.feature b/mod/bigbluebuttonbn/tests/behat/recordings_import.feature index 4b9c69ba273..045ddc354ca 100644 --- a/mod/bigbluebuttonbn/tests/behat/recordings_import.feature +++ b/mod/bigbluebuttonbn/tests/behat/recordings_import.feature @@ -7,6 +7,7 @@ Feature: Manage and list recordings And the following config values are set as admin: | bigbluebuttonbn_importrecordings_enabled | 1 | | bigbluebuttonbn_importrecordings_from_deleted_enabled | 1 | + And I enable "bigbluebuttonbn" "mod" plugin And the following "courses" exist: | fullname | shortname | category | | Test Course 1 | C1 | 0 | diff --git a/mod/bigbluebuttonbn/tests/behat/roles.feature b/mod/bigbluebuttonbn/tests/behat/roles.feature index 4e37f147e40..b1efd443797 100644 --- a/mod/bigbluebuttonbn/tests/behat/roles.feature +++ b/mod/bigbluebuttonbn/tests/behat/roles.feature @@ -3,6 +3,7 @@ Feature: Bigbluebuttonbn rooms When a meeting is created, roles for each type of participant can be changed Background: Make sure that a course is created + Given I enable "bigbluebuttonbn" "mod" plugin And the following course exists: | name | Test course | | shortname | C1 | diff --git a/mod/bigbluebuttonbn/tests/behat/room.feature b/mod/bigbluebuttonbn/tests/behat/room.feature index 113bf665724..e91e19b3614 100644 --- a/mod/bigbluebuttonbn/tests/behat/room.feature +++ b/mod/bigbluebuttonbn/tests/behat/room.feature @@ -3,6 +3,7 @@ Feature: The recording can be managed through the room page and as a user I can Background: Make sure that import recording is enabled and course, activities and recording exists Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin And the following "courses" exist: | fullname | shortname | category | | Test Course 1 | C1 | 0 | diff --git a/mod/bigbluebuttonbn/tests/behat/start_meeting.feature b/mod/bigbluebuttonbn/tests/behat/start_meeting.feature index f6d3310aa99..f8f2d783e3c 100644 --- a/mod/bigbluebuttonbn/tests/behat/start_meeting.feature +++ b/mod/bigbluebuttonbn/tests/behat/start_meeting.feature @@ -6,6 +6,7 @@ Feature: Test the ability to start a meeting Background: Given a BigBlueButton mock server is configured + And I enable "bigbluebuttonbn" "mod" plugin Scenario Outline: Users should be able to join a session depending on the Wait for moderator to join setting Given the following course exists: diff --git a/mod/bigbluebuttonbn/tests/generator/lib.php b/mod/bigbluebuttonbn/tests/generator/lib.php index 7fdf906578d..b4b9e2d0699 100644 --- a/mod/bigbluebuttonbn/tests/generator/lib.php +++ b/mod/bigbluebuttonbn/tests/generator/lib.php @@ -24,6 +24,7 @@ * @author Jesus Federico (jesus [at] blindsidenetworks [dt] com) */ +use core\plugininfo\mod; use mod_bigbluebuttonbn\instance; use mod_bigbluebuttonbn\logger; use mod_bigbluebuttonbn\recording; @@ -47,6 +48,12 @@ class mod_bigbluebuttonbn_generator extends \testing_module_generator { * @return stdClass record from module-defined table with additional field cmid */ public function create_instance($record = null, array $options = null) { + // Prior to creating the instance, make sure that the BigBlueButton module is enabled. + $modules = \core_plugin_manager::instance()->get_plugins_of_type('mod'); + if (!$modules['bigbluebuttonbn']->is_enabled()) { + mod::enable_plugin('bigbluebuttonbn', true); + } + $now = time(); $defaults = [ "type" => 0, diff --git a/mod/bigbluebuttonbn/tests/local/helpers/mod_helper_trait_test.php b/mod/bigbluebuttonbn/tests/local/helpers/mod_helper_trait_test.php index 2d2f7a28f4c..6656a0897b0 100644 --- a/mod/bigbluebuttonbn/tests/local/helpers/mod_helper_trait_test.php +++ b/mod/bigbluebuttonbn/tests/local/helpers/mod_helper_trait_test.php @@ -107,6 +107,9 @@ class mod_helper_trait_test extends \advanced_testcase { $generator = $this->getDataGenerator(); list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance(null, ['type' => instance::TYPE_RECORDING_ONLY]); + // Reset some static caches used by this test after enabling the plugin. + get_module_types_names(false, true); + $bbformdata = $this->get_form_data_from_instance($bbactivity); // Enrol users in a course so he will receive the message. @@ -137,6 +140,9 @@ class mod_helper_trait_test extends \advanced_testcase { $generator = $this->getDataGenerator(); list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance(null, ['type' => instance::TYPE_RECORDING_ONLY]); + // Reset some static caches used by this test after enabling the plugin. + get_module_types_names(false, true); + $bbformdata = $this->get_form_data_from_instance($bbactivity); $bbformdata->update = false; @@ -168,6 +174,9 @@ class mod_helper_trait_test extends \advanced_testcase { $generator = $this->getDataGenerator(); list($bbactivitycontext, $bbactivitycm, $bbactivity) = $this->create_instance(null, ['type' => instance::TYPE_RECORDING_ONLY]); + // Reset some static caches used by this test after enabling the plugin. + get_module_types_names(false, true); + $bbformdata = $this->get_form_data_from_instance($bbactivity); $bbformdata->completionunlocked = 0; $bbformdata->completion = COMPLETION_AGGREGATION_ANY; diff --git a/mod/bigbluebuttonbn/version.php b/mod/bigbluebuttonbn/version.php index 45670c38886..36ca3d2a9cb 100644 --- a/mod/bigbluebuttonbn/version.php +++ b/mod/bigbluebuttonbn/version.php @@ -27,6 +27,6 @@ defined('MOODLE_INTERNAL') || die; -$plugin->version = 2022041900; +$plugin->version = 2022041901; $plugin->requires = 2022041200; $plugin->component = 'mod_bigbluebuttonbn';