Improve isManagerOf() error handling to prevent possible security bug

master
Skylar Ittner 6 years ago
parent abb306a36e
commit ce8e0fb4e3

@ -1,4 +1,5 @@
<?php
/**
* Get user info for the given username.
* @param int $u username
@ -85,10 +86,10 @@ function isManagerOf($m, $e) {
$resp = json_decode($response->getBody(), TRUE);
if ($resp['status'] == "OK") {
return $resp['managerof'];
return $resp['managerof'] === true;
} else {
// this shouldn't happen, but in case it does just fake it.
return ["name" => $u, "username" => $u, "uid" => $u];
return false;
}
}
@ -119,4 +120,4 @@ function getManagedUIDs($manageruid) {
} else {
return [];
}
}
}

Loading…
Cancel
Save