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 aa48133096
commit 301d8fa5fa
1 changed files with 11 additions and 1 deletions

View File

@ -611,7 +611,17 @@ class Monitor extends ZM_Object {
function canView() { function canView() {
global $user; 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) { function AlarmCommand($cmd) {