Skip to content

Commit

Permalink
MDL-75894 bigbluebuttonbn: Return instance features info
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva committed Oct 10, 2022
1 parent cc4fec2 commit afc85e6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mod/bigbluebuttonbn/classes/external/meeting_info.php
Expand Up @@ -97,7 +97,13 @@ public static function execute(
bigbluebutton_proxy::get_server_not_available_url($instance),
bigbluebutton_proxy::get_server_not_available_message($instance));
}
return (array) meeting::get_meeting_info_for_instance($instance, $updatecache);
$meetinginfo = (array) meeting::get_meeting_info_for_instance($instance, $updatecache);

// Make the structure WS friendly.
array_walk($meetinginfo['features'], function(&$value, $key){
$value = ['name' => $key, 'isenabled' => (bool) $value];
});
return $meetinginfo;
}

/**
Expand Down Expand Up @@ -134,6 +140,12 @@ public static function execute_returns(): external_single_structure {
])
),
'joinurl' => new external_value(PARAM_URL, 'Join URL'),
'features' => new \external_multiple_structure(
new external_single_structure([
'name' => new external_value(PARAM_ALPHA, 'Feature name.'),
'isenabled' => new external_value(PARAM_BOOL, 'Whether the feature is enabled.'),
]), 'List of features for the instance', VALUE_OPTIONAL
),
]
);
}
Expand Down
3 changes: 3 additions & 0 deletions mod/bigbluebuttonbn/classes/meeting.php
Expand Up @@ -280,6 +280,9 @@ protected function do_get_meeting_info(bool $updatecache = false): stdClass {
$meetinginfo->attendees[] = (array) $attendee;
}
}

$meetinginfo->features = $instance->get_enabled_features();

return $meetinginfo;
}

Expand Down
11 changes: 11 additions & 0 deletions mod/bigbluebuttonbn/tests/meeting_test.php
Expand Up @@ -155,6 +155,17 @@ public function test_get_meeting_info(int $type, ?string $groupname) {
$meeting->update_cache();
$meetinginfo = $meeting->get_meeting_info();
$this->assertFalse($meetinginfo->statusrunning);

if ($type == instance::TYPE_ALL) {
$this->assertTrue($meetinginfo->features['showroom']);
$this->assertTrue($meetinginfo->features['showrecordings']);
} else if ($type == instance::TYPE_ROOM_ONLY) {
$this->assertTrue($meetinginfo->features['showroom']);
$this->assertFalse($meetinginfo->features['showrecordings']);
} else if ($type == instance::TYPE_RECORDING_ONLY) {
$this->assertFalse($meetinginfo->features['showroom']);
$this->assertTrue($meetinginfo->features['showrecordings']);
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions mod/bigbluebuttonbn/upgrade.txt
@@ -0,0 +1,5 @@
This files describes API changes in the bigbluebuttonbn code.

=== 4.1 ===
* External function mod_bigbluebuttonbn\external\meeting_info now return the list of the instance features and whether they are
enabled or not.

0 comments on commit afc85e6

Please sign in to comment.