Skip to content

Commit 92e4500

Browse files
committed
fix: lowercase alternative host email addresses for case insensitive comparisons
1 parent cea0487 commit 92e4500

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

locallib.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,13 @@ function zoom_get_alternative_host_array_from_string($alternativehoststring) {
795795
// The Zoom API has historically returned either semicolons or commas, so we need to support both.
796796
$alternativehoststring = str_replace(';', ',', $alternativehoststring);
797797
$alternativehostarray = array_filter(explode(',', $alternativehoststring));
798+
799+
// Lowercase email addresses so that we can do case-insensitive comparisons.
800+
foreach ($alternativehostarray as $key => $value) {
801+
if (filter_var($value, FILTER_VALIDATE_EMAIL) !== false) {
802+
$alternativehostarray[$key] = strtolower($value);
803+
}
804+
}
798805
return $alternativehostarray;
799806
}
800807

@@ -962,7 +969,12 @@ function zoom_load_meeting($id, $context, $usestarturl = true) {
962969

963970
$userisrealhost = (zoom_get_user_id(false) === $zoom->host_id);
964971
$alternativehosts = zoom_get_alternative_host_array_from_string($zoom->alternative_hosts);
965-
$userishost = ($userisrealhost || in_array(zoom_get_api_identifier($USER), $alternativehosts, true));
972+
// Lowercase email addresses so that we can do case-insensitive comparisons.
973+
if (filter_var(zoom_get_api_identifier($USER), FILTER_VALIDATE_EMAIL) !== false) {
974+
$userishost = ($userisrealhost || in_array(strtolower(zoom_get_api_identifier($USER)), $alternativehosts, true));
975+
} else {
976+
$userishost = ($userisrealhost || in_array(zoom_get_api_identifier($USER), $alternativehosts, true));
977+
}
966978

967979
// Check if we should use the start meeting url.
968980
if ($userisrealhost && $usestarturl) {

view.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@
6464
$alternativehosts = zoom_get_alternative_host_array_from_string($zoom->alternative_hosts);
6565

6666
// Check if this user is the host or an alternative host.
67-
$userishost = ($userisrealhost || in_array(zoom_get_api_identifier($USER), $alternativehosts, true));
67+
// Lowercase email addresses so that we can do case-insensitive comparisons.
68+
if (filter_var(zoom_get_api_identifier($USER), FILTER_VALIDATE_EMAIL) !== false) {
69+
$userishost = ($userisrealhost || in_array(strtolower(zoom_get_api_identifier($USER)), $alternativehosts, true));
70+
} else {
71+
$userishost = ($userisrealhost || in_array(zoom_get_api_identifier($USER), $alternativehosts, true));
72+
}
6873

6974
// Get host user from Zoom.
7075
$showrecreate = false;

0 commit comments

Comments
 (0)