Skip to content

Commit 0414154

Browse files
committed
view: prioritize Moodle capabilities over assumed access of hosts
1 parent 4d38f67 commit 0414154

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

lang/en/zoom.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@
416416
$string['showsecurity_help'] = 'Enabling this option will show the Security section on the meeting activity page.';
417417
$string['showsecurityonview'] = 'Show Security section on meeting page';
418418
$string['start'] = 'Start';
419-
$string['start_meeting'] = 'Start Meeting';
420419
$string['start_time'] = 'When';
421420
$string['starthostjoins'] = 'Start video when host joins';
422421
$string['startpartjoins'] = 'Start video when participant joins';

view.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@
5858
$zoomuserid = zoom_get_user_id(false);
5959

6060
// Check if this user is the (real) host.
61-
if (!is_role_switched($course->id)) {
62-
$userisrealhost = ($zoomuserid === $zoom->host_id);
63-
}
61+
$userisrealhost = ($zoomuserid === $zoom->host_id);
6462

6563
// Get the alternative hosts of the meeting.
6664
$alternativehosts = zoom_get_alternative_host_array_from_string($zoom->alternative_hosts);
@@ -97,7 +95,6 @@
9795

9896
$stryes = get_string('yes');
9997
$strno = get_string('no');
100-
$strstart = get_string('start_meeting', 'mod_zoom');
10198
$strjoin = get_string('join_meeting', 'mod_zoom');
10299
$strregister = get_string('register', 'mod_zoom');
103100
$strtime = get_string('meeting_time', 'mod_zoom');
@@ -151,7 +148,7 @@
151148
// Only show if the admin did not disable this feature completely.
152149
if (!$showrecreate && $config->showcapacitywarning == true) {
153150
// Only show if the user viewing this is the host.
154-
if ($userishost && $iszoommanager) {
151+
if ($iszoommanager) {
155152
// Get meeting capacity.
156153
$meetingcapacity = zoom_get_meeting_capacity($zoom->host_id, $zoom->webinar);
157154

@@ -204,8 +201,11 @@
204201

205202
// Show join meeting button or unavailability note.
206203
if (!$showrecreate) {
207-
// If registration is required, check the registration.
208-
if (!$userishost && $zoom->registration != ZOOM_REGISTRATION_OFF) {
204+
if ($userishost) {
205+
// Hosts are pre-registered.
206+
$userisregistered = true;
207+
} else if ($zoom->registration != ZOOM_REGISTRATION_OFF) {
208+
// If registration is required, check the registration.
209209
$userisregistered = zoom_is_user_registered_for_meeting($USER->email, $zoom->meeting_id, $zoom->webinar);
210210

211211
// Unregistered users are allowed to register.
@@ -216,18 +216,15 @@
216216

217217
if ($available) {
218218
// Show join meeting button.
219-
if ($userishost && $iszoommanager) {
220-
$buttonhtml = html_writer::tag('button', $strstart, ['type' => 'submit', 'class' => 'btn btn-success']);
221-
} else {
222-
$btntext = $strjoin;
223-
// If user is not already registered, use register text.
224-
if ($zoom->registration != ZOOM_REGISTRATION_OFF && !$userisregistered) {
225-
$btntext = $strregister;
226-
}
219+
$btntext = $strjoin;
227220

228-
$buttonhtml = html_writer::tag('button', $btntext, ['type' => 'submit', 'class' => 'btn btn-primary']);
221+
// If user is not already registered, use register text.
222+
if ($zoom->registration != ZOOM_REGISTRATION_OFF && !$userisregistered) {
223+
$btntext = $strregister;
229224
}
230225

226+
$buttonhtml = html_writer::tag('button', $btntext, ['type' => 'submit', 'class' => 'btn btn-primary']);
227+
231228
$aurl = new moodle_url('/mod/zoom/loadmeeting.php', ['id' => $cm->id]);
232229
$buttonhtml .= html_writer::input_hidden_params($aurl);
233230
$link = html_writer::tag('form', $buttonhtml, ['action' => $aurl->out_omit_querystring(), 'target' => '_blank']);
@@ -449,7 +446,7 @@
449446
// Get passcode information.
450447
$haspassword = (isset($zoom->password) && $zoom->password !== '');
451448
$strhaspass = ($haspassword) ? $stryes : $strno;
452-
$canviewjoinurl = (($userishost && $iszoommanager) || has_capability('mod/zoom:viewjoinurl', $context));
449+
$canviewjoinurl = has_capability('mod/zoom:viewjoinurl', $context);
453450

454451
// Show passcode status.
455452
$rowhaspass = new html_table_row();
@@ -583,7 +580,7 @@
583580
if (
584581
!$showrecreate
585582
&& ($zoom->option_audio === ZOOM_AUDIO_BOTH || $zoom->option_audio === ZOOM_AUDIO_TELEPHONY)
586-
&& (($userishost && $iszoommanager) || has_capability('mod/zoom:viewdialin', $context))
583+
&& has_capability('mod/zoom:viewdialin', $context)
587584
) {
588585
// Get meeting invitation from Zoom.
589586
$meetinginvite = zoom_webservice()->get_meeting_invitation($zoom)->get_display_string($cm->id);

0 commit comments

Comments
 (0)