Change monitor->canView semantics so that a specified monitorId trumps the Monitors:None setting. This is so that the console can be hidden, but the group dropdown still gets populated.

This commit is contained in:
Isaac Connor 2021-08-15 09:52:48 -04:00
parent a2f3583481
commit a1fe4e2638
1 changed files with 11 additions and 1 deletions

View File

@ -596,7 +596,17 @@ class Monitor extends ZM_Object {
function canView() {
global $user;
return ( $user && ($user['Monitors'] != 'None') && ( !$this->{'Id'} || visibleMonitor($this->{'Id'}) ));
if (!$user) {
# auth turned on and not logged in
return false;
}
if (!empty($user['MonitorIds']) ) {
# For the purposes of viewing, having specified monitors trumps the Monitor->canView setting.
if (in_array($this->{'Id'}, explode(',', $user['MonitorIds']))) {
return true;
}
}
return ($user['Monitors'] != 'None');
}
function AlarmCommand($cmd) {