diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-17 15:18:03 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-17 15:18:03 +0000 |
| commit | 01e94d67317be183b74fa97bd3d15ee99ab27d69 (patch) | |
| tree | ab0b8c8e4a6fa804f4171fcc42f5add9cf72eb13 /frontends/php/include | |
| parent | 717eb6f9ed27471f3213d188d29bd267ff726a0f (diff) | |
- [DEV-175] improvements to showed users last login time (Artem)
- [DEV-178] more fixes to permission scheme (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5776 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/blocks.inc.php | 7 | ||||
| -rw-r--r-- | frontends/php/include/config.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/defines.inc.php | 3 | ||||
| -rw-r--r-- | frontends/php/include/perm.inc.php | 9 | ||||
| -rw-r--r-- | frontends/php/include/profiles.inc.php | 2 |
5 files changed, 16 insertions, 7 deletions
diff --git a/frontends/php/include/blocks.inc.php b/frontends/php/include/blocks.inc.php index b0c45a24..e8ce905c 100644 --- a/frontends/php/include/blocks.inc.php +++ b/frontends/php/include/blocks.inc.php @@ -374,11 +374,14 @@ function make_status_of_zbx(){ $table->AddRow(array(S_NUMBER_OF_ALERTS,$status['alerts_count'],' - '));*/ //Log Out 10min - $sql = 'SELECT DISTINCT u.userid, s.lastaccess, u.autologout '. + $sql = 'SELECT DISTINCT u.userid, MAX(s.lastaccess) as lastaccess, u.autologout '. ' FROM users u '. - ' LEFT JOIN sessions s ON s.userid=u.userid'; + ' LEFT JOIN sessions s ON s.userid=u.userid'. + ' WHERE '.DBin_node('u.userid'). + ' GROUP BY u.userid,u.autologout'; $db_users = DBSelect($sql); + $usr_cnt = 0; $online_cnt = 0; while($user=DBFetch($db_users)){ diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index a6caf779..6ce15123 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -273,6 +273,8 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! if ( count($ZBX_CURRENT_SUBNODES) < 2 && !defined('ZBX_DISABLE_SUBNODES') ) define('ZBX_DISABLE_SUBNODES', 1); + + $ZBX_CURRENT_SUBNODES = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST, PERM_RES_IDS_ARRAY); } function get_current_nodeid($forse_with_subnodes = null, $perm = null){ diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index 7b3986ec..e90f817a 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -33,6 +33,9 @@ define('ZBX_LOGIN_ATTEMPTS', 5); define('ZBX_LOGIN_BLOCK', 30); + + define('ZBX_SESSION_ACTIVE', 0); + define('ZBX_SESSION_PASSIVE', 1); define('T_ZBX_STR', 0); define('T_ZBX_INT', 1); diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php index b4288da1..0a8538dd 100644 --- a/frontends/php/include/perm.inc.php +++ b/frontends/php/include/perm.inc.php @@ -50,6 +50,7 @@ function check_authorisation(){ $login = $USER_DETAILS = DBfetch(DBselect('SELECT u.*,s.* '. ' FROM sessions s,users u'. ' WHERE s.sessionid='.zbx_dbstr($sessionid). + ' AND s.status='.ZBX_SESSION_ACTIVE. ' AND s.userid=u.userid'. ' AND ((s.lastaccess+u.autologout>'.time().') OR (u.autologout=0))'. ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID))); @@ -86,20 +87,20 @@ function check_authorisation(){ if($login){ zbx_setcookie("zbx_sessionid",$sessionid,$USER_DETAILS['autologin']?(time()+86400*31):0); //1 month - DBexecute("update sessions set lastaccess=".time()." where sessionid=".zbx_dbstr($sessionid)); + DBexecute('UPDATE sessions SET lastaccess='.time().' WHERE sessionid='.zbx_dbstr($sessionid)); } else{ $USER_DETAILS = NULL; zbx_unsetcookie('zbx_sessionid'); - DBexecute("delete from sessions where sessionid=".zbx_dbstr($sessionid)); + DBexecute('UPDATE sessions SET status='.ZBX_SESSION_PASSIVE.' WHERE sessionid='.zbx_dbstr($sessionid)); unset($sessionid); } if($USER_DETAILS){ $USER_DETAILS['node'] = DBfetch(DBselect('select * from nodes where nodeid='.id2nodeid($USER_DETAILS['userid']))); - if(empty($USER_DETAILS['node'])) - { + + if(empty($USER_DETAILS['node'])){ $USER_DETAILS['node']['name'] = '- unknown -'; $USER_DETAILS['node']['nodeid'] = $ZBX_LOCALNODEID; } diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php index 6436916b..668e7ce6 100644 --- a/frontends/php/include/profiles.inc.php +++ b/frontends/php/include/profiles.inc.php @@ -335,7 +335,7 @@ function get_favorites($favobj,$nodeid=null){ if(is_null($nodeid)) $nodeid = get_current_nodeid(); - + if(!is_array($nodeid)) $nodeid = array($nodeid); |
