mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-74782 mod_bigbluebuttonbn: Fix only imported
* When Show imported links only is enabled in activity or config, only imported recordings will appear * Logic for activity/default overrides implemented
This commit is contained in:
parent
417d1b918b
commit
6236be46e1
3 changed files with 67 additions and 0 deletions
|
@ -763,6 +763,18 @@ EOF;
|
||||||
return $this->is_feature_enabled('importrecordings');
|
return $this->is_feature_enabled('importrecordings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get recordings_imported from instancedata.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_recordings_imported(): bool {
|
||||||
|
if (config::get('recordings_imported_editable')) {
|
||||||
|
return (bool) $this->get_instance_var('recordings_imported');
|
||||||
|
}
|
||||||
|
return config::get('recordings_imported_default');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this instance is recorded from the start.
|
* Whether this instance is recorded from the start.
|
||||||
*
|
*
|
||||||
|
|
|
@ -296,6 +296,10 @@ class recording_data {
|
||||||
if ($rec->get('imported')) {
|
if ($rec->get('imported')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// When show imported recordings only is enabled, exclude all other recordings.
|
||||||
|
if ($instance->get_recordings_imported() && !$rec->get('imported')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Administrators and moderators are always allowed.
|
// Administrators and moderators are always allowed.
|
||||||
if ($instance->is_admin() || $instance->is_moderator()) {
|
if ($instance->is_admin() || $instance->is_moderator()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -314,6 +314,57 @@ class get_recordings_test extends \externallib_advanced_testcase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check we can see only imported recordings in a recordings only instance when "Show only imported links" enabled.
|
||||||
|
* @covers \mod_bigbluebuttonbn\external\get_recordings::execute
|
||||||
|
*/
|
||||||
|
public function test_get_imported_recordings_only() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
set_config('bigbluebuttonbn_importrecordings_enabled', 1);
|
||||||
|
$dataset = [
|
||||||
|
'type' => instance::TYPE_ALL,
|
||||||
|
'groups' => null,
|
||||||
|
'users' => [['username' => 's1', 'role' => 'student']],
|
||||||
|
'recordingsdata' => [
|
||||||
|
[['name' => 'Recording1']],
|
||||||
|
[['name' => 'Recording2']]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$activityid = $this->create_from_dataset($dataset);
|
||||||
|
$instance = instance::get_from_instanceid($activityid);
|
||||||
|
|
||||||
|
// Now create a recording only activity.
|
||||||
|
$plugingenerator = $this->getDataGenerator()->get_plugin_generator('mod_bigbluebuttonbn');
|
||||||
|
// Now create a new activity and import the first record.
|
||||||
|
$newactivity = $plugingenerator->create_instance([
|
||||||
|
'course' => $instance->get_course_id(),
|
||||||
|
'type' => instance::TYPE_RECORDING_ONLY,
|
||||||
|
'name' => 'Example 2'
|
||||||
|
]);
|
||||||
|
$plugingenerator->create_meeting([
|
||||||
|
'instanceid' => $newactivity->id,
|
||||||
|
]); // We need to have a meeting created in order to import recordings.
|
||||||
|
$newinstance = instance::get_from_instanceid($newactivity->id);
|
||||||
|
$recordings = $instance->get_recordings();
|
||||||
|
foreach ($recordings as $recording) {
|
||||||
|
if ($recording->get('name') == 'Recording1') {
|
||||||
|
$recording->create_imported_recording($newinstance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user = \core_user::get_user_by_username('s1');
|
||||||
|
$this->setUser($user);
|
||||||
|
$getrecordings = $this->get_recordings($newinstance->get_instance_id());
|
||||||
|
$data = json_decode($getrecordings['tabledata']['data']);
|
||||||
|
// Check that all recordings including the imported recording appear.
|
||||||
|
$this->assertCount(3, $data);
|
||||||
|
// Set the flags to enable "Show only imported links".
|
||||||
|
set_config('bigbluebuttonbn_recordings_imported_default', 1);
|
||||||
|
set_config('bigbluebuttonbn_recordings_imported_editable', 0);
|
||||||
|
$getrecordings = $this->get_recordings($newinstance->get_instance_id());
|
||||||
|
$data = json_decode($getrecordings['tabledata']['data']);
|
||||||
|
$this->assertCount(1, $data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if recording are visible/invisible depending on the group.
|
* Check if recording are visible/invisible depending on the group.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue