Test for null in user before testing for access in CanEdit et all
This commit is contained in:
parent
4632bbd124
commit
0de6396a5b
|
@ -220,19 +220,19 @@ function generateAuthHash($useRemoteAddr, $force=false) {
|
|||
function visibleMonitor($mid) {
|
||||
global $user;
|
||||
|
||||
return ( empty($user['MonitorIds']) || in_array($mid, explode(',', $user['MonitorIds'])) );
|
||||
return ( $user && empty($user['MonitorIds']) || in_array($mid, explode(',', $user['MonitorIds'])) );
|
||||
}
|
||||
|
||||
function canView($area, $mid=false) {
|
||||
global $user;
|
||||
|
||||
return ( ($user[$area] == 'View' || $user[$area] == 'Edit') && ( !$mid || visibleMonitor($mid) ) );
|
||||
return ( $user && ($user[$area] == 'View' || $user[$area] == 'Edit') && ( !$mid || visibleMonitor($mid) ) );
|
||||
}
|
||||
|
||||
function canEdit($area, $mid=false) {
|
||||
global $user;
|
||||
|
||||
return ( $user[$area] == 'Edit' && ( !$mid || visibleMonitor($mid) ));
|
||||
return ( $user && ($user[$area] == 'Edit') && ( !$mid || visibleMonitor($mid) ));
|
||||
}
|
||||
|
||||
function userFromSession() {
|
||||
|
|
Loading…
Reference in New Issue