mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-73199' of git://github.com/jfederico/moodle
This commit is contained in:
commit
c8abe79865
@ -18,6 +18,7 @@ namespace mod_bigbluebuttonbn\local\bigbluebutton\recordings;
|
||||
|
||||
use mod_bigbluebuttonbn\instance;
|
||||
use mod_bigbluebuttonbn\recording;
|
||||
use mod_bigbluebuttonbn\local\config;
|
||||
|
||||
/**
|
||||
* Collection of helper methods for handling recordings actions in Moodle.
|
||||
@ -70,10 +71,12 @@ class recording_action {
|
||||
* @param recording $recording
|
||||
*/
|
||||
public static function unprotect(recording $recording) {
|
||||
if (!(boolean) config::get('recording_protect_editable')) {
|
||||
// Recording protect action through UI is disabled, there is no need to do anything else.
|
||||
throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'unprotect');
|
||||
}
|
||||
if ($recording->get('imported')) {
|
||||
/* Since the recording link is the one fetched from the BBB server, imported recordings can not be
|
||||
* unprotected. There is no need to do anything else.
|
||||
*/
|
||||
// Imported recordings can not be unprotected. There is no need to do anything else.
|
||||
throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'unprotect');
|
||||
}
|
||||
$recording->set('protected', false);
|
||||
@ -86,10 +89,12 @@ class recording_action {
|
||||
* @param recording $recording
|
||||
*/
|
||||
public static function protect(recording $recording) {
|
||||
if (!(boolean) config::get('recording_protect_editable')) {
|
||||
// Recording protect action through UI is disabled, there is no need to do anything else.
|
||||
throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'protect');
|
||||
}
|
||||
if ($recording->get('imported')) {
|
||||
/* Since the recording link is the one fetched from the BBB server, imported recordings can not be
|
||||
* protected. There is no need to do anything else.
|
||||
*/
|
||||
// Imported recordings can not be unprotected. There is no need to do anything else.
|
||||
throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'protect');
|
||||
}
|
||||
$recording->set('protected', true);
|
||||
|
@ -70,8 +70,12 @@ class recording_data {
|
||||
|
||||
// Build table content.
|
||||
foreach ($recordings as $recording) {
|
||||
// Protected recordings is not a standard feature, remove actions when protected flag is not present.
|
||||
$rowtools = $tools;
|
||||
// Protected recordings may be enabled or disabled from UI through configuration.
|
||||
if (!(boolean) config::get('recording_protect_editable')) {
|
||||
$rowtools = array_diff($rowtools, ['protect', 'unprotect']);
|
||||
}
|
||||
// Protected recordings is not a standard feature, remove actions when protected flag is not present.
|
||||
if (in_array('protect', $rowtools) && $recording->get('protected') === null) {
|
||||
$rowtools = array_diff($rowtools, ['protect', 'unprotect']);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ class config {
|
||||
'recording_all_from_start_editable' => false,
|
||||
'recording_hide_button_default' => false,
|
||||
'recording_hide_button_editable' => false,
|
||||
'recording_protect_editable' => true,
|
||||
'general_warning_message' => '',
|
||||
'general_warning_roles' => 'editingteacher,teacher',
|
||||
'general_warning_box_type' => 'info',
|
||||
@ -204,6 +205,7 @@ class config {
|
||||
'recording_all_from_start_editable' => self::get('recording_all_from_start_editable'),
|
||||
'recording_hide_button_default' => self::get('recording_hide_button_default'),
|
||||
'recording_hide_button_editable' => self::get('recording_hide_button_editable'),
|
||||
'recording_protect_editable' => self::get('recording_protect_editable'),
|
||||
'general_warning_message' => self::get('general_warning_message'),
|
||||
'general_warning_box_type' => self::get('general_warning_box_type'),
|
||||
'general_warning_button_text' => self::get('general_warning_button_text'),
|
||||
|
@ -87,6 +87,13 @@ class recording_proxy extends proxy_base {
|
||||
* @return bool
|
||||
*/
|
||||
public static function protect_recording(string $recordid, string $protected = 'true'): bool {
|
||||
global $CFG;
|
||||
|
||||
// Ignore action if recording_protect_editable is set to false.
|
||||
if (empty($CFG->bigbluebuttonbn_recording_protect_editable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = self::fetch_endpoint_xml('updateRecordings', [
|
||||
'recordID' => $recordid,
|
||||
'protect' => $protected,
|
||||
|
@ -53,7 +53,8 @@ class setting_validator {
|
||||
!isset($CFG->bigbluebuttonbn['recording_all_from_start_default']) ||
|
||||
!isset($CFG->bigbluebuttonbn['recording_all_from_start_editable']) ||
|
||||
!isset($CFG->bigbluebuttonbn['recording_hide_button_default']) ||
|
||||
!isset($CFG->bigbluebuttonbn['recording_hide_button_editable']) );
|
||||
!isset($CFG->bigbluebuttonbn['recording_hide_button_editable'])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +83,8 @@ class setting_validator {
|
||||
!isset($CFG->bigbluebuttonbn['recordings_imported_editable']) ||
|
||||
!isset($CFG->bigbluebuttonbn['recordings_preview_default']) ||
|
||||
!isset($CFG->bigbluebuttonbn['recordings_preview_editable']) ||
|
||||
!isset($CFG->bigbluebuttonbn['recordings_validate_url'])
|
||||
!isset($CFG->bigbluebuttonbn['recordings_validate_url']) ||
|
||||
!isset($CFG->bigbluebuttonbn['recording_protect_editable'])
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -486,6 +486,17 @@ class settings {
|
||||
$item,
|
||||
$showrecordingsettings
|
||||
);
|
||||
$item = new admin_setting_configcheckbox(
|
||||
'bigbluebuttonbn_recording_protect_editable',
|
||||
get_string('config_recording_protect_editable', 'bigbluebuttonbn'),
|
||||
get_string('config_recording_protect_editable_description', 'bigbluebuttonbn'),
|
||||
1
|
||||
);
|
||||
$this->add_conditional_element(
|
||||
'recording_protect_editable',
|
||||
$item,
|
||||
$showrecordingsettings
|
||||
);
|
||||
}
|
||||
$this->admin->add($this->section, $showrecordingsettings);
|
||||
}
|
||||
|
@ -137,6 +137,8 @@ $string['config_recording_default'] = 'Recording feature enabled by default';
|
||||
$string['config_recording_default_description'] = 'If enabled the sessions created in BigBlueButton will have recording capabilities.';
|
||||
$string['config_recording_editable'] = 'Recording feature can be edited';
|
||||
$string['config_recording_editable_description'] = 'If checked the interface includes an option for enable and disable the recording feature.';
|
||||
$string['config_recording_protect_editable'] = 'Protected recordings state can be edited';
|
||||
$string['config_recording_protect_editable_description'] = 'If checked the interface includes an option for protecting/unprotecting recordings.';
|
||||
$string['config_recording_icons_enabled'] = 'Icons for recording management';
|
||||
$string['config_recording_icons_enabled_description'] = 'When enabled, the recording management panel shows icons for the publish/unpublish and delete actions.';
|
||||
$string['config_recording_all_from_start_default'] = 'Record all from start';
|
||||
|
Loading…
x
Reference in New Issue
Block a user