summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-29 12:12:26 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-29 12:12:26 +0000
commit0c12891108a86a1059340fd5597a08bd05db8024 (patch)
tree80bbad9358e585e1580745ab941a4468ce38f1d2 /frontends/php
parent6ccee53e0c5951bfd9d349863a6afa05437551f6 (diff)
- [DEV-103] added support of disabling login rights for a users group (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5287 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/include/classes/ctag.inc.php13
-rw-r--r--frontends/php/include/db.inc.php4
-rw-r--r--frontends/php/include/defines.inc.php7
-rw-r--r--frontends/php/include/forms.inc.php52
-rw-r--r--frontends/php/include/locales/en_gb.inc.php7
-rw-r--r--frontends/php/include/perm.inc.php71
-rw-r--r--frontends/php/include/users.inc.php377
-rw-r--r--frontends/php/index.php15
-rw-r--r--frontends/php/js/menu.js989
-rw-r--r--frontends/php/styles/div.css3
-rw-r--r--frontends/php/styles/link.css5
-rw-r--r--frontends/php/users.php306
12 files changed, 1166 insertions, 683 deletions
diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php
index 97cc2325..44cc5050 100644
--- a/frontends/php/include/classes/ctag.inc.php
+++ b/frontends/php/include/classes/ctag.inc.php
@@ -221,7 +221,7 @@
{
unset($this->options[$name]);
}
- function &GetOption($name)
+ function GetOption($name)
{
$ret = NULL;
if(isset($this->options[$name]))
@@ -256,13 +256,20 @@
function AddAction($name, $value)
{
- if(!empty($value))
+ if(is_object($value)){
+ $this->options[$name] = unpack_object($value);
+ }
+ else if(!empty($value)){
$this->options[$name] = htmlentities(str_replace(array("\r", "\n"), '', strval($value)),ENT_COMPAT,S_HTML_CHARSET);
+ }
}
function AddOption($name, $value)
{
- if(isset($value))
+ if(is_object($value)){
+ $this->options[$name] = unpack_object($value);
+ }
+ else if(isset($value))
$this->options[$name] = htmlspecialchars(strval($value));
else
unset($this->options[$name]);
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 46d56c7f..e60bc250 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -408,10 +408,10 @@
switch($DB_TYPE)
{
case "MYSQL":
- $result = mysql_fetch_array($cursor);
+ $result = mysql_fetch_assoc($cursor);
break;
case "POSTGRESQL":
- $result = pg_fetch_array($cursor);
+ $result = pg_fetch_assoc($cursor);
break;
case "ORACLE":
if(ocifetchinto($cursor, $row, OCI_ASSOC+OCI_NUM+OCI_RETURN_NULLS))
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 7328c677..8bbceb64 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -338,8 +338,11 @@
define('USER_TYPE_ZABBIX_ADMIN', 2);
define('USER_TYPE_SUPER_ADMIN', 3);
- define('USER_STATUS_DISABLED', 1);
- define('USER_STATUS_ENABLED', 0);
+ define('GROUP_STATUS_DISABLED', 1);
+ define('GROUP_STATUS_ENABLED', 0);
+
+ define('GROUP_GUI_ACCESS_DISABLED', 1);
+ define('GROUP_GUI_ACCESS_ENABLED', 0);
define('PERM_MAX', 3);
define('PERM_READ_WRITE', 3);
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 21c2170c..6a895cef 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -702,7 +702,6 @@
$autologout = $user["autologout"];
$lang = $user["lang"];
$refresh = $user["refresh"];
- $status = $user["status"];
$user_type = $user["type"];
$user_groups = array();
@@ -743,7 +742,6 @@
$autologout = get_request("autologout",900);
$lang = get_request("lang","en_gb");
$refresh = get_request("refresh",30);
- $status = get_request('status',0);
$user_type = get_request("user_type",USER_TYPE_ZABBIX_USER);;
$user_groups = get_request("user_groups",array());
$change_password = get_request("change_password", null);
@@ -883,18 +881,6 @@
$frmUser->AddRow(S_URL_AFTER_LOGIN, new CTextBox("url",$url,50));
$frmUser->AddRow(S_SCREEN_REFRESH, new CNumericBox("refresh",$refresh,4));
- if((bccomp($USER_DETAILS['userid'],$userid) == 0)){
- $frmUser->AddVar('status',USER_STATUS_ENABLED);
- $frmUser->AddRow(S_STATUS, new CSpan(S_ENABLED,'green'));
- }
- else{
- $cmbStat = new CComboBox('status',$status);
- $cmbStat->AddItem(USER_STATUS_ENABLED,S_ENABLED);
- $cmbStat->AddItem(USER_STATUS_DISABLED,S_DISABLED);
-
- $frmUser->AddRow(S_STATUS, $cmbStat);
- }
-
if($profile==0)
{
$frmUser->AddVar('perm_details', $perm_details);
@@ -964,7 +950,7 @@
# Insert form for User Groups
function insert_usergroups_form()
{
- global $_REQUEST;
+ global $USER_DETAILS;
$frm_title = S_USER_GROUP;
if(isset($_REQUEST["usrgrpid"]))
@@ -975,8 +961,11 @@
if(isset($_REQUEST["usrgrpid"]) && !isset($_REQUEST["form_refresh"]))
{
- $name = $usrgrp["name"];
+ $name = $usrgrp['name'];
+ $users_status = $usrgrp['users_status'];
+ $gui_access = $usrgrp['gui_access'];
+
$group_users = array();
$db_users=DBselect("SELECT distinct u.userid,u.alias FROM users u,users_groups ug ".
"where u.userid=ug.userid AND ug.usrgrpid=".$_REQUEST["usrgrpid"].
@@ -1012,7 +1001,9 @@
}
else
{
- $name = get_request("gname","");
+ $name = get_request("gname","");
+ $users_status = get_request('users_status',0);
+ $gui_access = get_request('gui_access',0);
$group_users = get_request("group_users",array());
$group_rights = get_request("group_rights",array());
}
@@ -1054,6 +1045,33 @@
(count($group_users) > 0) ? new CButton('del_group_user',S_DELETE_SELECTED) : null
));
+ $granted = true;
+ if(isset($_REQUEST['usrgrpid'])){
+ $granted = granted2update_group($_REQUEST['usrgrpid']);
+ }
+
+ if($granted){
+ $cmbGUI = new CComboBox('gui_access',$gui_access);
+ $cmbGUI->AddItem(GROUP_GUI_ACCESS_ENABLED,S_ENABLED);
+ $cmbGUI->AddItem(GROUP_GUI_ACCESS_DISABLED,S_DISABLED);
+
+ $frmUserG->AddRow(S_GUI_ACCESS, $cmbGUI);
+
+ $cmbStat = new CComboBox('users_status',$users_status);
+ $cmbStat->AddItem(GROUP_STATUS_ENABLED,S_ENABLED);
+ $cmbStat->AddItem(GROUP_STATUS_DISABLED,S_DISABLED);
+
+ $frmUserG->AddRow(S_USERS_STATUS, $cmbStat);
+
+ }
+ else{
+ $frmUserG->AddVar('gui_access',GROUP_GUI_ACCESS_ENABLED);
+ $frmUserG->AddRow(S_GUI_ACCESS, new CSpan(S_ENABLED,'green'));
+
+ $frmUserG->AddVar('users_status',GROUP_STATUS_ENABLED);
+ $frmUserG->AddRow(S_USERS_STATUS, new CSpan(S_ENABLED,'green'));
+ }
+
$table_Rights = new CTable(S_NO_RIGHTS_DEFINED,'right_table');
$lstWrite = new CListBox('right_to_del[read_write][]' ,null ,20);
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index d24778a8..3422f27c 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -1297,6 +1297,8 @@
'S_GROUP_DELETED'=> 'Group deleted',
'S_CANNOT_DELETE_GROUP'=> 'Cannot delete group',
'S_USER_CANNOT_DISABLE_ITSELF'=> 'User cannot disable itself',
+ 'S_USER_CANNOT_CHANGE_STATUS'=> 'User cannot change status to itself',
+ 'S_USER_CANNOT_CHANGE_GUI_ACCESS'=> 'User cannot change GUI access to itself',
'S_USER_CANNOT_DELETE_ITSELF'=> 'User cannot delete itself',
'S_CONFIGURATION_OF_USERS_AND_USER_GROUPS'=>'CONFIGURATION OF USERS AND USER GROUPS',
'S_USER_GROUPS_BIG'=> 'USER GROUPS',
@@ -1316,6 +1318,8 @@
'S_PERMISSION'=> 'Permission',
'S_RIGHT'=> 'Right',
'S_RIGHTS'=> 'Rights',
+ 'S_GUI_ACCESS'=> 'GUI access',
+ 'S_USERS_STATUS'=> 'Users status',
'S_NO_RIGHTS_DEFINED'=> 'No rights defined',
'S_RESOURCE_NAME'=> 'Resource name',
'S_READ_ONLY'=> 'Read only',
@@ -1332,6 +1336,9 @@
'S_CREATE_GROUP'=> 'Create Group',
'S_DELETE_SELECTED_USERS_Q'=> 'Delete selected users?',
'S_NO_ACCESSIBLE_RESOURCES'=> 'No accessibles resources',
+ 'S_ADD_TO'=> 'Add to',
+ 'S_REMOVE_FROM'=> 'Remove from',
+ 'S_STATUS_DISABLED'=> 'Status disabled',
//scripts.php
'S_SCRIPTS'=> 'Scripts',
diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php
index 750ffe1b..10522455 100644
--- a/frontends/php/include/perm.inc.php
+++ b/frontends/php/include/perm.inc.php
@@ -48,21 +48,25 @@
if( !is_null($sessionid))
{
- if(!($USER_DETAILS = DBfetch(DBselect('SELECT u.*,s.* FROM sessions s,users u'.
- ' WHERE s.sessionid='.zbx_dbstr($sessionid).
- ' AND s.userid=u.userid'.
- ' AND ((s.lastaccess+u.autologout>'.time().') OR (u.autologout=0))'.
- ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID).
- ' AND u.status='.USER_STATUS_ENABLED))))
- {
+ $login = $USER_DETAILS = DBfetch(DBselect('SELECT u.*,s.* FROM sessions s,users u'.
+ ' WHERE s.sessionid='.zbx_dbstr($sessionid).
+ ' AND s.userid=u.userid'.
+ ' AND ((s.lastaccess+u.autologout>'.time().') OR (u.autologout=0))'.
+ ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
+ if($login){
+ $login = (check_perm2login($USER_DETAILS['userid']) && check_perm2system($USER_DETAILS['userid']));
+ }
+
+ if(!$login){
+ $USER_DETAILS = NULL;
+
zbx_unsetcookie('zbx_sessionid');
DBexecute("delete from sessions where sessionid=".zbx_dbstr($sessionid));
unset($sessionid);
$incorrect_session = true;
}
- else
- {
+ else{
zbx_setcookie("zbx_sessionid",$sessionid);
DBexecute("update sessions set lastaccess=".time()." where sessionid=".zbx_dbstr($sessionid));
}
@@ -71,8 +75,7 @@
if(!$USER_DETAILS){
if(!($USER_DETAILS = DBfetch(DBselect('SELECT u.* FROM users u '.
' WHERE u.alias='.zbx_dbstr(ZBX_GUEST_USER).
- ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID).
- ' AND u.status='.USER_STATUS_ENABLED))))
+ ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)))))
{
$missed_user_guest = true;
}
@@ -115,6 +118,52 @@
}
/***********************************************
+ CHECK USER ACCESS TO SYSTEM STATUS
+************************************************/
+/* Function: check_perm2system()
+ *
+ * Description:
+ * Checking user permissions to access system (affects server side: no notification will be sent)
+ *
+ * Comments:
+ * return true if permission is positive
+ *
+ * Author: Aly
+ */
+ function check_perm2system($userid){
+ $sql = 'SELECT COUNT(g.usrgrpid) as grp_count '.
+ ' FROM usrgrp g, users_groups ug '.
+ ' WHERE ug.userid = '.zbx_dbstr($userid).
+ ' AND g.usrgrpid = ug.usrgrpid '.
+ ' AND g.users_status = '.GROUP_STATUS_DISABLED;
+ $res = DBFetch(DBSelect($sql));
+
+ return ($res['grp_count'] == 0)?true:false;
+ }
+
+/* Function: check_perm2login()
+ *
+ * Description:
+ * Checking user permissions to Login in frontend
+ *
+ * Comments:
+ * return true if permission is positive
+ *
+ * Author: Aly
+ */
+
+ function check_perm2login($userid){
+ $sql = 'SELECT COUNT(g.usrgrpid) as grp_count '.
+ ' FROM usrgrp g, users_groups ug '.
+ ' WHERE ug.userid = '.zbx_dbstr($userid).
+ ' AND g.usrgrpid = ug.usrgrpid '.
+ ' AND g.gui_access = '.GROUP_GUI_ACCESS_DISABLED;
+ $res = DBFetch(DBSelect($sql));
+
+ return ($res['grp_count'] == 0)?true:false;
+ }
+
+/***********************************************
GET ACCESSIBLE RESOURCES BY USERID
************************************************/
function perm_mode2comparator($perm_mode)
diff --git a/frontends/php/include/users.inc.php b/frontends/php/include/users.inc.php
index af84528d..4c2e8ae1 100644
--- a/frontends/php/include/users.inc.php
+++ b/frontends/php/include/users.inc.php
@@ -33,7 +33,7 @@
# Add User definition
- function add_user($name,$surname,$alias,$passwd,$url,$autologout,$lang,$refresh,$user_type,$status,$user_groups,$user_medias)
+ function add_user($name,$surname,$alias,$passwd,$url,$autologout,$lang,$refresh,$user_type,$user_groups,$user_medias)
{
global $USER_DETAILS;
@@ -54,8 +54,6 @@
' values ('.$userid.','.zbx_dbstr($name).','.zbx_dbstr($surname).','.zbx_dbstr($alias).','.
zbx_dbstr(md5($passwd)).','.zbx_dbstr($url).','.$autologout.','.zbx_dbstr($lang).','.$refresh.','.$user_type.')');
- $result &= change_user_status($userid,$status);
-
if($result)
{
DBexecute('delete from users_groups where userid='.$userid);
@@ -88,7 +86,7 @@
# Update User definition
- function update_user($userid,$name,$surname,$alias,$passwd, $url,$autologout,$lang,$refresh,$user_type,$status,$user_groups,$user_medias)
+ function update_user($userid,$name,$surname,$alias,$passwd, $url,$autologout,$lang,$refresh,$user_type,$user_groups,$user_medias)
{
if(DBfetch(DBselect("select * from users where alias=".zbx_dbstr($alias).
" and userid<>$userid and ".DBin_node('userid', get_current_nodeid(false)))))
@@ -102,8 +100,6 @@
",url=".zbx_dbstr($url).","."autologout=$autologout,lang=".zbx_dbstr($lang).",refresh=$refresh,".
"type=$user_type".
" where userid=$userid");
-
- $result &= change_user_status($userid,$status);
if($result)
{
@@ -182,33 +178,86 @@
}
- function get_user_by_userid($userid){
+ function get_user_by_userid($userid){
if($row = DBfetch(DBselect('select * from users where userid='.zbx_dbstr($userid)))){
return $row;
}
/* error("No user with id [$userid]"); */
return false;
}
+
- function change_user_status($userid,$status){
- global $USER_DETAILS;
- $res = false;
- if((bccomp($USER_DETAILS['userid'],$userid) == 0) && ($status==USER_STATUS_DISABLED)){
- error(S_USER_CANNOT_DISABLE_ITSELF);
+ function get_userid_by_usrgrpid($usrgrpid){
+ $userids = array();
+ if($res=DBselect('SELECT DISTINCT u.userid '.
+ ' FROM users u,users_groups ug '.
+ ' WHERE u.userid=ug.userid '.
+ ' AND ug.usrgrpid='.$usrgrpid.
+ ' AND '.DBin_node('ug.usrgrpid', get_current_nodeid(false))))
+ {
+ while($rows = DBFetch($res)) $userids[]=$rows['userid'];
+ }
+
+ return $userids;
+ }
+
+
+ function add_user_to_group($userid,$usrgrpid){
+ $result = false;
+ if(granted2move_user($userid,$usrgrpid)){
+ DBexecute('delete from users_groups where userid='.$userid.' and usrgrpid='.$usrgrpid);
+
+ $users_groups_id = get_dbid("users_groups","id");
+ $result = DBexecute('insert into users_groups (id,usrgrpid,userid) values('.$users_groups_id.','.$usrgrpid.','.$userid.')');
}
else{
- $res = DBexecute('UPDATE users SET status='.$status.' WHERE userid='.zbx_dbstr($userid));
+ error(S_USER_CANNOT_CHANGE_STATUS);
}
- return $res;
+ return $result;
+ }
+
+ function remove_user_from_group($userid,$usrgrpid){
+ $result = false;
+ if(granted2move_user($userid,$usrgrpid)){
+ $result = DBexecute('delete from users_groups where userid='.$userid.' and usrgrpid='.$usrgrpid);
+ }
+ else{
+ error(S_USER_CANNOT_CHANGE_STATUS);
+ }
+ return $result;
+ }
+
+
+// description:
+// checks if user is adding himself to disabled group
+ function granted2update_group($usrgrpid){
+ global $USER_DETAILS;
+ $users = get_userid_by_usrgrpid($usrgrpid);
+ $result=(!uint_in_array($USER_DETAILS['userid'],$users));
+ return $result;
}
+
+
+// description:
+// checks if user is adding himself to disabled group
+ function granted2move_user($userid,$usrgrpid){
+ global $USER_DETAILS;
+
+ $result = true;
+ $group = get_group_by_usrgrpid($usrgrpid);
+ if(($group['gui_access'] == GROUP_GUI_ACCESS_DISABLED) || ($group['users_status'] == GROUP_STATUS_DISABLED)){
+ $result=(bccomp($USER_DETAILS['userid'],$userid)!=0);
+ }
+ return $result;
+ }
/**************************
USER GROUPS
**************************/
- function add_user_group($name,$users=array(),$rights=array())
- {
+ function add_user_group($name,$users_status,$gui_access,$users=array(),$rights=array()){
+
if(DBfetch(DBselect('select * from usrgrp where name='.zbx_dbstr($name).' and '.DBin_node('usrgrpid', get_current_nodeid(false)))))
{
error("Group '$name' already exists");
@@ -219,29 +268,33 @@
$result=DBexecute("insert into usrgrp (usrgrpid,name) values ($usrgrpid,".zbx_dbstr($name).")");
if(!$result) return $result;
-
- $result=DBexecute("delete from users_groups where usrgrpid=".$usrgrpid);
- foreach($users as $userid => $name)
- {
- $id = get_dbid('users_groups','id');
- $result=DBexecute('insert into users_groups (id,usrgrpid,userid) values ('.$id.','.$usrgrpid.','.$userid.')');
+
+// must come before adding user to group
+ $result&=change_group_status($usrgrpid,$users_status);
+ $result&=change_group_gui_access($usrgrpid,$gui_access);
+ if(!$result) return $result;
+//--------
+
+ foreach($users as $userid => $name){
+ $result &= add_user_to_group($userid,$usrgrpid);
if(!$result) return $result;
}
$result=DBexecute("delete from rights where groupid=".$usrgrpid);
- foreach($rights as $right)
- {
+ foreach($rights as $right){
$id = get_dbid('rights','rightid');
$result=DBexecute('insert into rights (rightid,groupid,type,permission,id)'.
' values ('.$id.','.$usrgrpid.','.$right['type'].','.$right['permission'].','.$right['id'].')');
+
if(!$result) return $result;
}
-
+
return $result;
}
- function update_user_group($usrgrpid,$name,$users=array(),$rights=array())
- {
+ function update_user_group($usrgrpid,$name,$users_status,$gui_access,$users=array(),$rights=array()){
+ global $USER_DETAILS;
+
if(DBfetch(DBselect('select * from usrgrp where name='.zbx_dbstr($name).
' and usrgrpid<>'.$usrgrpid.' and '.DBin_node('usrgrpid', get_current_nodeid(false)))))
{
@@ -250,33 +303,43 @@
}
$result=DBexecute("update usrgrp set name=".zbx_dbstr($name)." where usrgrpid=$usrgrpid");
- if(!$result)
- {
- return $result;
- }
+ if(!$result) return $result;
+
+// must come before adding user to group
+ $result&=change_group_status($usrgrpid,$users_status);
+ $result&=change_group_gui_access($usrgrpid,$gui_access);
+ if(!$result) return $result;
+//-------
- $result=DBexecute("delete from users_groups where usrgrpid=".$usrgrpid);
- foreach($users as $userid => $name)
- {
- $id = get_dbid('users_groups','id');
- $result=DBexecute('insert into users_groups (id,usrgrpid,userid) values ('.$id.','.$usrgrpid.','.$userid.')');
- if(!$result) return $result;
+ $grant = true;
+ if(($gui_access == GROUP_GUI_ACCESS_DISABLED) || ($users_status == GROUP_STATUS_DISABLED)){
+ $grant = (!uint_in_array($USER_DETAILS['userid'],$users));
}
-
+ if($grant){
+ $result = DBexecute('delete from users_groups where usrgrpid='.zbx_dbstr($usrgrpid));
+ foreach($users as $userid => $name){
+ $result &= add_user_to_group($userid,$usrgrpid);
+ if(!$result) return $result;
+ }
+ }
+ else{
+ error(S_USER_CANNOT_DISABLE_ITSELF);
+ return false;
+ }
+
$result=DBexecute("delete from rights where groupid=".$usrgrpid);
- foreach($rights as $right)
- {
+ foreach($rights as $right){
$id = get_dbid('rights','rightid');
$result=DBexecute('insert into rights (rightid,groupid,type,permission,id)'.
' values ('.$id.','.$usrgrpid.','.$right['type'].','.$right['permission'].','.$right['id'].')');
+
if(!$result) return $result;
}
return $result;
}
- function delete_user_group($usrgrpid)
- {
+ function delete_user_group($usrgrpid){
$result = DBexecute("delete from rights where groupid=$usrgrpid");
if(!$result) return $result;
@@ -286,16 +349,234 @@
if(!$result) return $result;
$result = DBexecute("delete from usrgrp where usrgrpid=$usrgrpid");
- return $result;
+ return $result;
}
- function get_group_by_usrgrpid($usrgrpid)
- {
- if($row = DBfetch(DBselect("select * from usrgrp where usrgrpid=".$usrgrpid)))
- {
+ function get_group_by_usrgrpid($usrgrpid){
+ if($row = DBfetch(DBselect("select * from usrgrp where usrgrpid=".$usrgrpid))){
return $row;
}
/* error("No user groups with id [$usrgrpid]"); */
- return FALSE;
+ return FALSE;
+ }
+
+
+ function change_group_status($usrgrpid,$users_status){
+ $res = false;
+
+ $grant = true;
+ if($users_status == GROUP_STATUS_DISABLED) $grant = granted2update_group($usrgrpid);
+
+ if($grant){
+ $res = DBexecute('UPDATE usrgrp SET users_status='.$users_status.' WHERE usrgrpid='.$usrgrpid);
+ }
+ else{
+ error(S_USER_CANNOT_CHANGE_STATUS);
+ }
+ return $res;
+ }
+
+
+ function change_group_gui_access($usrgrpid,$gui_access){
+ $res = false;
+
+ $grant = true;
+ if($gui_access == GROUP_GUI_ACCESS_DISABLED) $grant= granted2update_group($usrgrpid);
+
+ if($grant){
+ $res = DBexecute('UPDATE usrgrp SET gui_access='.$gui_access.' WHERE usrgrpid='.$usrgrpid);
+ }
+ else{
+ error(S_USER_CANNOT_CHANGE_GUI_ACCESS);
+ }
+ return $res;
}
+
+/********************************/
+
+ function get_user_actionmenu($userid){
+ global $USER_DETAILS;
+
+ $action = new CSpan(S_SELECT);
+
+// add to group
+ $menus = "Array(Array('".S_GROUPS."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}),
+ Array('".S_ADD_TO."',null,null,{'outer' : ['pum_o_submenu'],'inner' : ['pum_i_submenu']},";
+ $menus.= "['".S_GROUPS."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
+
+ $grp_list = '(';
+ if($res = DBselect('SELECT DISTINCT ug.usrgrpid '.
+ ' FROM users_groups ug'.
+ ' WHERE ug.userid='.zbx_dbstr($userid).
+ ' AND '.DBin_node('ug.usrgrpid', get_current_nodeid(false))))
+ {
+ while($tmp = DBFetch($res)) $grp_list.= "'".$tmp['usrgrpid']."'".',';
+ }
+ $grp_list=rtrim($grp_list,',').')';
+
+ $res = DBselect('SELECT DISTINCT g.usrgrpid, g.name, g.gui_access, g.users_status'.
+ ' FROM usrgrp g'.
+ ' WHERE g.usrgrpid NOT IN'.$grp_list.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false)).
+ ' ORDER BY g.name');
+
+ while($group=DBfetch($res)){
+ if(!granted2move_user($userid,$group['usrgrpid'])) continue;
+
+ $caption = new CSpan($group['name']);
+ if($group['users_status'] == GROUP_STATUS_DISABLED){
+ $caption->SetClass('red');
+ }
+ else if($group['gui_access'] == GROUP_GUI_ACCESS_DISABLED){
+ $caption->SetClass('orange');
+ }
+
+ $caption = htmlspecialchars(unpack_object($caption));
+ $menus.="['".$caption."','users.php?config=0&form=update&grpaction=1&userid=".$userid."&usrgrpid=".$group['usrgrpid']."']\n,";
+ }
+
+ $menus=rtrim($menus,',').'),';
+// remove from group
+ $menus.= "Array('".S_REMOVE_FROM."',null,null,{'outer' : 'pum_o_submenu','inner' : ['pum_i_submenu']},";
+ $menus.= "['".S_GROUPS."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
+
+ $res = DBselect('SELECT DISTINCT g.usrgrpid, g.name, g.gui_access, g.users_status '.
+ ' FROM usrgrp g, users_groups ug'.
+ ' WHERE ug.userid='.zbx_dbstr($userid).
+ ' AND ug.usrgrpid = g.usrgrpid '.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false)).
+ ' ORDER BY g.name');
+
+ while($group=DBfetch($res)){
+ if(!granted2move_user($userid,$group['usrgrpid'])) continue;
+
+ $caption = new CSpan($group['name']);
+ if($group['users_status'] == GROUP_STATUS_DISABLED){
+ $caption->SetClass('red');
+ }
+ else if($group['gui_access'] == GROUP_GUI_ACCESS_DISABLED){
+ $caption->SetClass('orange');
+ }
+
+ $caption = htmlspecialchars(unpack_object($caption));
+ $menus.="['".$caption."','users.php?config=0&form=update&grpaction=0&userid=".$userid."&usrgrpid=".$group['usrgrpid']."']\n,";
+ }
+
+ $menus=rtrim($menus,',').'),';
+ if($USER_DETAILS['userid'] == $userid){
+ $menus=rtrim($menus,',').')';
+ }
+ else{
+// add to GUI ACCESS
+ $menus.= "Array('".S_GUI_ACCESS."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}),
+ Array('".S_ADD_TO."',null,null,{'outer' : 'pum_o_submenu','inner' : ['pum_i_submenu']},";
+ $menus.= "['".S_GUI_ACCESS."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
+
+ $grp_list = '(';
+ if($res = DBselect('SELECT DISTINCT ug.usrgrpid '.
+ ' FROM users_groups ug, usrgrp g'.
+ ' WHERE ug.userid='.zbx_dbstr($userid).
+ ' AND g.gui_access='.GROUP_GUI_ACCESS_DISABLED.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false))))
+ {
+ while($tmp = DBFetch($res)) $grp_list.= "'".$tmp['usrgrpid']."'".',';
+ }
+ $grp_list=rtrim($grp_list,',').')';
+
+ $res = DBselect('SELECT DISTINCT g.usrgrpid, g.name'.
+ ' FROM usrgrp g'.
+ ' WHERE g.usrgrpid NOT IN'.$grp_list.
+ ' AND g.gui_access='.GROUP_GUI_ACCESS_DISABLED.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false)).
+ ' ORDER BY g.name');
+
+ while($group=DBfetch($res)){
+ $caption = new CSpan($group['name'],'orange');
+ $caption = htmlspecialchars(unpack_object($caption));
+ $menus.="['".$caption."','users.php?config=0&form=update&grpaction=1&userid=".$userid."&usrgrpid=".$group['usrgrpid']."']\n,";
+ }
+
+ $menus=rtrim($menus,',').'),';
+// remove from GUI ACCESS
+ $menus.= "Array('".S_REMOVE_FROM."',null,null,{'outer' : 'pum_o_submenu','inner' : ['pum_i_submenu']},";
+ $menus.= "['".S_GUI_ACCESS."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
+
+ $res = DBselect('SELECT g.name, g.usrgrpid'.
+ ' FROM usrgrp g, users_groups ug'.
+ ' WHERE ug.userid='.zbx_dbstr($userid).
+ ' AND ug.usrgrpid = g.usrgrpid '.
+ ' AND g.gui_access='.GROUP_GUI_ACCESS_DISABLED.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false)).
+ ' ORDER BY g.name');
+
+ while($group=DBfetch($res)){
+ $caption = new CSpan($group['name'],'orange');
+ $caption = htmlspecialchars(unpack_object($caption));
+
+ $menus.="['".$caption."','users.php?config=0&form=update&grpaction=0&userid=".$userid."&usrgrpid=".$group['usrgrpid']."']\n,";
+ }
+
+ $menus=rtrim($menus,',').'),';
+
+// add to DISABLED
+ $menus.= "Array('".S_STATUS_DISABLED."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}),
+ Array('".S_ADD_TO."',null,null,{'outer' : 'pum_o_submenu','inner' : ['pum_i_submenu']},";
+ $menus.= "['".S_STATUS_DISABLED."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
+
+ $grp_list = '(';
+ if($res = DBselect('SELECT DISTINCT ug.usrgrpid '.
+ ' FROM users_groups ug, usrgrp g'.
+ ' WHERE ug.userid='.zbx_dbstr($userid).
+ ' AND g.users_status='.GROUP_STATUS_DISABLED.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false))))
+ {
+ while($tmp = DBFetch($res)) $grp_list.= "'".$tmp['usrgrpid']."'".',';
+ }
+ $grp_list=rtrim($grp_list,',').')';
+
+ $res = DBselect('SELECT DISTINCT g.usrgrpid, g.name'.
+ ' FROM usrgrp g'.
+ ' WHERE g.usrgrpid NOT IN'.$grp_list.
+ ' AND g.users_status='.GROUP_STATUS_DISABLED.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false)).
+ ' ORDER BY g.name');
+
+ while($group=DBfetch($res)){
+ $caption = new CSpan($group['name'],'red');
+ $caption = htmlspecialchars(unpack_object($caption));
+
+ $menus.="['".$caption."','users.php?config=0&form=update&grpaction=1&userid=".$userid."&usrgrpid=".$group['usrgrpid']."']\n,";
+ }
+
+ $menus=rtrim($menus,',').'),';
+// remove from DISABLED
+ $menus.= "Array('".S_REMOVE_FROM."',null,null,{'outer' : 'pum_o_submenu','inner' : ['pum_i_submenu']},";
+ $menus.= "['".S_STATUS_DISABLED."',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
+
+ $res = DBselect('SELECT g.name, g.usrgrpid'.
+ ' FROM usrgrp g, users_groups ug'.
+ ' WHERE ug.userid='.zbx_dbstr($userid).
+ ' AND ug.usrgrpid = g.usrgrpid '.
+ ' AND g.users_status='.GROUP_STATUS_DISABLED.
+ ' AND '.DBin_node('g.usrgrpid', get_current_nodeid(false)).
+ ' ORDER BY g.name');
+
+
+ while($group=DBfetch($res)){
+ $caption = new CSpan($group['name'],'red');
+ $caption = htmlspecialchars(unpack_object($caption));
+
+ $menus.="['".$caption."','users.php?config=0&form=update&grpaction=0&userid=".$userid."&usrgrpid=".$group['usrgrpid']."']\n,";
+ }
+
+ $menus=rtrim($menus,',').'))';
+ }
+
+ $script = new CScript("javascript: show_popup_menu(event,".$menus.",240);");
+ $action->AddAction('onclick',$script);
+ $action->AddOption('onmouseover','javascript: this.style.cursor = "pointer";');
+
+ return $action;
+ }
+
?>
diff --git a/frontends/php/index.php b/frontends/php/index.php
index e71e19f4..f9d00f88 100644
--- a/frontends/php/index.php
+++ b/frontends/php/index.php
@@ -61,14 +61,16 @@
$name = get_request("name","");
$password = md5(get_request("password",""));
- $row = DBfetch(DBselect('SELECT u.userid,u.alias,u.name,u.surname,u.url,u.refresh '.
+ $login = $row = DBfetch(DBselect('SELECT u.userid,u.alias,u.name,u.surname,u.url,u.refresh '.
' FROM users u, users_groups ug, usrgrp g '.
' WHERE u.alias='.zbx_dbstr($name).
' AND u.passwd='.zbx_dbstr($password).
- ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID).
- ' AND u.status='.USER_STATUS_ENABLED));
+ ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
+ if($login){
+ $login = (check_perm2login($row['userid']) && check_perm2system($row['userid']));
+ }
- if($row){
+ if($login){
$sessionid = md5(time().$password.$name.rand(0,10000000));
zbx_setcookie('zbx_sessionid',$sessionid);
@@ -88,8 +90,9 @@
die();
// return;
}
- else
- {
+ else{
+ $row = NULL;
+
$_REQUEST['message'] = "Login name or password is incorrect";
add_audit(AUDIT_ACTION_LOGIN,AUDIT_RESOURCE_USER,"Login failed [".$name."]");
}
diff --git a/frontends/php/js/menu.js b/frontends/php/js/menu.js
index 406bc705..a6ec0d2c 100644
--- a/frontends/php/js/menu.js
+++ b/frontends/php/js/menu.js
@@ -1,494 +1,495 @@
-/*
-** ZABBIX
-** Copyright (C) 2000-2005 SIA Zabbix
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-
-// Title: tigra menu
-// Description: See the demo at url
-// URL: http://www.softcomplex.com/products/tigra_menu/
-// Version: 2.0 (commented source)
-// Date: 04-05-2003 (mm-dd-yyyy)
-// Tech. Support: http://www.softcomplex.com/forum/forumdisplay.php?fid=40
-// Notes: This script is free. Visit official site for further details.
-// This script adapted by Eugene Grigorjev for using as popup menu
-// of ZABBIX software. See http://www.zabbix.com.
-//debugger;
-
-function show_popup_menu(e, content, width)
-{
- if(!width) width = 170;
-
- var pos = [
- {'block_top': -12, 'block_left': -5, 'width': width},
- {'block_top': 5, 'block_left': width-5, 'width': width}
- ];
-
- var cursor = get_cursor_position(e);
-
- new popup_menu (content, pos, cursor.x, cursor.y);
-
- return false;
-}
-
-// --------------------------------------------------------------------------------
-// global collection containing all menus on current page
-var A_MENUS = [];
-
-// --------------------------------------------------------------------------------
-// menu class
-function popup_menu (a_items, a_tpl, x, y) {
-
- // browser check
- if (!document.body || !document.body.style)
- return;
-
- this.n_scroll_left = get_scroll_pos()[0];
- this.n_scroll_top = get_scroll_pos()[1];
-
- if(document.body.clientWidth)
- {
- this.n_scr_width = document.body.clientWidth;
- this.n_scr_height = document.body.clientHeight;
- }
- else
- {
- this.n_scr_width = document.width;
- this.n_scr_height = document.height;
- }
-
- // store items structure
- this.a_config = a_items;
-
- // store template structure
- this.a_tpl = a_tpl;
-
- // get menu id
- this.n_id = A_MENUS.length;
-
- // declare collections
- this.a_index = [];
- this.a_children = [];
-
- // assigh methods and event handlers
- this.expand = menu_expand;
- this.collapse = menu_collapse;
-
- this.onclick = menu_onclick;
- this.onmouseout = menu_onmouseout;
- this.onmouseover = menu_onmouseover;
- this.onmousedown = menu_onmousedown;
-
- this.getstyle = mitem_getstyle;
-
- this.set_x_direction = mitem_set_x_direction;
- this.get_x_direction = mitem_get_x_direction;
- this.set_y_direction = mitem_set_y_direction;
- this.get_y_direction = mitem_get_y_direction;
-
- // default level scope description structure
- this.a_tpl_def = {
- 'block_top' : 0,
- 'block_left' : 0,
- 'top' : 23,
- 'left' : 0,
- 'width' : 170,
- 'height' : 24,
- 'hide_delay' : 200,
- 'expd_delay' : 200
- };
-
- /* default css */
- this.a_css_def = {
- 'outer' : ['pum_o_item'],
- 'inner' : ['pum_i_item']
- };
-
-
- // assign methods and properties required to imulate parent item
- this.getprop = function (s_key) {
- return this.a_tpl_def[s_key];
- };
-
- this.o_root = this;
- this.n_depth = -1;
- this.n_x = x;
- this.n_y = y;
-
- // init items recursively
- for (n_order = 0; n_order < a_items.length; n_order++)
- new menu_item(this, n_order);
-
- // register self in global collection
- A_MENUS[this.n_id] = this;
-
- // make root level visible
- for (var n_order = 0; n_order < this.a_children.length; n_order++)
- this.a_children[n_order].e_oelement.style.visibility = 'visible';
-}
-
-// --------------------------------------------------------------------------------
-function mitem_set_x_direction(n_val) {
- this.n_x_direction = n_val;
-}
-
-function mitem_get_x_direction() {
- return (this.n_x_direction ? this.n_x_direction : null);
-}
-
-function mitem_set_y_direction(n_val) {
- this.n_y_direction = n_val;
-}
-
-function mitem_get_y_direction() {
- return (this.n_y_direction ? this.n_y_direction : null);
-}
-
-// --------------------------------------------------------------------------------
-function menu_collapse (n_id) {
- // cancel item open delay
- clearTimeout(this.o_showtimer);
-
- // by default collapse all levels
- var n_tolevel = (n_id ? this.a_index[n_id].n_depth : -1);
- if(-1 == n_tolevel){
- for (n_id = 0; n_id < this.a_index.length; n_id++){
- var o_curritem = this.a_index[n_id];
- if(o_curritem){
- var e_oelement = document.getElementById(o_curritem.e_oelement.id);
- if(e_oelement != null){
- document.body.removeChild(e_oelement);
- }
- }
- }
- A_MENUS.splice(this.o_root.n_id);
- } else {
- // hide all items over the level specified
- for (n_id = 0; n_id < this.a_index.length; n_id++) {
- var o_curritem = this.a_index[n_id];
- if (o_curritem && o_curritem.n_depth > n_tolevel && o_curritem.b_visible) {
- o_curritem.e_oelement.style.visibility = 'hidden';
- o_curritem.b_visible = false;
- }
- }
- }
-
- // reset current item if mouse has gone out of items
- if (!n_id) this.o_current = null;
-}
-
-// --------------------------------------------------------------------------------
-function menu_expand (n_id) {
-
- // expand only when mouse is over some menu item
- if (this.o_hidetimer)
- return;
-
- // lookup current item
- var o_item = this.a_index[n_id];
-
- // close previously opened items
- if (this.o_current && this.o_current.n_depth >= o_item.n_depth)
- this.collapse(o_item.n_id);
- this.o_current = o_item;
-
- // exit if there are no children to open
- if (!o_item.a_children)
- return;
-
- // show direct child items
- for (var n_order = 0; n_order < o_item.a_children.length; n_order++) {
- var o_curritem = o_item.a_children[n_order];
- o_curritem.e_oelement.style.visibility = 'visible';
- o_curritem.b_visible = true;
- }
-}
-
-// --------------------------------------------------------------------------------
-//
-// --------------------------------------------------------------------------------
-function menu_onclick (n_id) {
- // don't go anywhere if item has no link defined
- // lookup new item's object
- if(Boolean(this.a_index[n_id].a_config[1])){
- // lookup new item's object
- var o_item = this.a_index[n_id];
-
- // apply rollout
- o_item.e_oelement.className = o_item.getstyle(0, 0);
- o_item.e_ielement.className = o_item.getstyle(1, 0);
-
- // update status line
- o_item.upstatus(7);
-
- this.o_hidetimer = setTimeout('A_MENUS['+ this.n_id +'].collapse();', 100);//o_item.getprop('hide_delay'));
- //this.collapse();
- //alert(A_MENUS[this.n_id].a_config[1][1]);
- return true;
- }
- return false;
-}
-
-// --------------------------------------------------------------------------------
-function menu_onmouseout (n_id) {
-
- // lookup new item's object
- var o_item = this.a_index[n_id];
-
- // apply rollout
- o_item.e_oelement.className = o_item.getstyle(0, 0);
- o_item.e_ielement.className = o_item.getstyle(1, 0);
-
- // update status line
- o_item.upstatus(7);
-
- // run mouseover timer
- this.o_hidetimer = setTimeout('A_MENUS['+ this.n_id +'].collapse();', o_item.getprop('hide_delay'));
-}
-
-// --------------------------------------------------------------------------------
-function menu_onmouseover (n_id) {
-
- // cancel mouseoute menu close and item open delay
- clearTimeout(this.o_hidetimer);
- this.o_hidetimer = null;
- clearTimeout(this.o_showtimer);
-
- // lookup new item's object
- var o_item = this.a_index[n_id];
-
- // update status line
- o_item.upstatus();
-
- // apply rollover
- o_item.e_oelement.className = o_item.getstyle(0, 1);
- o_item.e_ielement.className = o_item.getstyle(1, 1);
-
- // if onclick open is set then no more actions required
- if (o_item.getprop('expd_delay') < 0)
- return;
-
- // run expand timer
- this.o_showtimer = setTimeout('A_MENUS['+ this.n_id +'].expand(' + n_id + ');',
- o_item.getprop('expd_delay'));
-
-}
-
-// --------------------------------------------------------------------------------
-// called when mouse button is pressed on menu item
-// --------------------------------------------------------------------------------
-function menu_onmousedown (n_id) {
- // lookup new item's object
- var o_item = this.a_index[n_id];
-
- // apply mouse down style
- o_item.e_oelement.className = o_item.getstyle(0, 2);
- o_item.e_ielement.className = o_item.getstyle(1, 2);
-
- this.expand(n_id);
-// this.items[id].switch_style('onmousedown');
-}
-
-
-// --------------------------------------------------------------------------------
-// menu item Class
-
-function menu_item (o_parent, n_order) {
-
- // store parameters passed to the constructor
- this.n_depth = o_parent.n_depth + 1;
-
- var item_offset = this.n_depth ? 4 : 0;
- this.a_config = o_parent.a_config[n_order + item_offset];
-
- // return if required parameters are missing
- if (!this.a_config || !this.a_config[0])
- {
- return;
- }
-
- // store info from parent item
- this.o_root = o_parent.o_root;
- this.o_parent = o_parent;
- this.n_order = n_order;
-
- // register in global and parent's collections
- this.n_id = this.o_root.a_index.length + 1;
- this.o_root.a_index[this.n_id] = this;
- o_parent.a_children[n_order] = this;
-
- // calculate item's coordinates
- var o_root = this.o_root,
- a_tpl = this.o_root.a_tpl;
-
- this.a_css = this.a_config[3] ? this.a_config[3] : null;
-
- // assign methods
- this.getprop = mitem_getprop;
- this.getstyle = mitem_getstyle;
- this.upstatus = mitem_upstatus;
-
- this.set_x_direction = mitem_set_x_direction;
- this.get_x_direction = mitem_get_x_direction;
- this.set_y_direction = mitem_set_y_direction;
- this.get_y_direction = mitem_get_y_direction;
-
- if(!o_parent.n_x_direction && !n_order)
- {
- // calculate menu direction in first element
- o_parent.set_x_direction(
- (this.getprop('width') + o_parent.n_x + this.getprop('block_left')
- > o_root.n_scr_width + o_root.n_scroll_left)
- ? -1 : 1
- );
- }
-
- this.n_x = n_order
- ? o_parent.a_children[n_order - 1].n_x + this.getprop('left') * o_parent.get_x_direction()
- : o_parent.n_x + this.getprop('block_left') * o_parent.get_x_direction();
-
- if(-1 == o_parent.get_x_direction() && o_parent == o_root && !n_order)
- {
- this.n_x -= this.getprop('width');
- }
-
- if(!o_parent.n_y_direction && !n_order)
- {
- //alert("w: " +this.getprop('height') +" i:" + (o_parent.a_config.length - item_offset) );
- // calculate menu direction in first element
- o_parent.set_y_direction(
- (this.getprop('height') * (o_parent.a_config.length - item_offset) + o_parent.n_y + this.getprop('block_top')
- > o_root.n_scr_height + o_root.n_scroll_top)
- ? -1 : 1
- );
- }
-
- this.n_y = n_order
- ? o_parent.a_children[n_order - 1].n_y + this.getprop('top')
- : o_parent.n_y + this.getprop('block_top') * (o_parent == o_root ? o_parent.get_y_direction() : 1);
-
- if(-1 == o_parent.get_y_direction() && !n_order)
- {
- this.n_y -= this.getprop('height') * (o_parent.a_config.length - item_offset);
- }
-
- // generate item's HMTL
- var el = document.createElement("a");
- el.setAttribute('id', 'e' + o_root.n_id + '_' + this.n_id + 'o');
- el.setAttribute('href', this.a_config[1]);
-
- if(this.a_config[2] && this.a_config[2]['tw'])
- el.setAttribute('target', this.a_config[2]['tw']);
-
- el.className = this.getstyle(0, 0);
- el.style.position = 'absolute';
- el.style.top = this.n_y + 'px';
- el.style.left = this.n_x + 'px';
- el.style.width = this.getprop('width') + 'px';
- el.style.height = this.getprop('height') + 'px';
- el.style.visibility = 'hidden';
- el.style.zIndex = this.n_depth;
-
- el.o_root_n_id = o_root.n_id;
- el.this_n_id = this.n_id;
-
- el.onclick = A_MENUS_onclick;
- el.onmouseout = A_MENUS_onmouseout;
- el.onmouseover = A_MENUS_onmouseover;
- el.onmousedown = A_MENUS_onmousedown;
-
- el.innerHTML = '<div id="e' + o_root.n_id + '_' + this.n_id +'i" class="' + this.getstyle(1, 0) + '">' + this.a_config[0] + '</div>';
-// console.log(el,el.innerHTML);
- document.body.appendChild(el);
-
- this.e_ielement = document.getElementById('e' + o_root.n_id + '_' + this.n_id + 'i');
- this.e_oelement = document.getElementById('e' + o_root.n_id + '_' + this.n_id + 'o');
-
- this.b_visible = !this.n_depth;
-
- // no more initialization if leaf
- if (this.a_config.length < item_offset)
- return;
-
- // node specific methods and properties
- this.a_children = [];
-
- // init downline recursively
- for (var n_order = 0; n_order < this.a_config.length - item_offset; n_order++)
- new menu_item(this, n_order);
-}
-
-function A_MENUS_onclick(){ return A_MENUS[this.o_root_n_id].onclick(this.this_n_id); }
-function A_MENUS_onmouseout(){ return A_MENUS[this.o_root_n_id].onmouseout(this.this_n_id); }
-function A_MENUS_onmouseover(){ return A_MENUS[this.o_root_n_id].onmouseover(this.this_n_id); }
-function A_MENUS_onmousedown(){ return A_MENUS[this.o_root_n_id].onmousedown(this.this_n_id); }
-
-// --------------------------------------------------------------------------------
-// reads property from template file, inherits from parent level if not found
-// ------------------------------------------------------------------------------------------
-function mitem_getprop (s_key) {
-
- // check if value is defined for current level
- var s_value = null,
- a_level = this.o_root.a_tpl[this.n_depth];
-
- // return value if explicitly defined
- if (a_level)
- s_value = a_level[s_key];
-
- // request recursively from parent levels if not defined
- return (s_value == null ? this.o_parent.getprop(s_key) : s_value);
-}
-// --------------------------------------------------------------------------------
-// reads property from template file, inherits from parent level if not found
-// ------------------------------------------------------------------------------------------
-function mitem_getstyle (n_pos, n_state) {
-
- var a_css = this.a_css;
-
- // request recursively from parent levels if not defined
- if(!a_css)
- a_css = this.o_root.a_css_def;
-
- //var a_css = this.o_root.a_css;
-
- var a_oclass = a_css[n_pos ? 'inner' : 'outer'];
-
- // same class for all states
- if (typeof(a_oclass) == 'string')
- return a_oclass;
-
- // inherit class from previous state if not explicitly defined
- for (var n_currst = n_state; n_currst >= 0; n_currst--)
- if (a_oclass[n_currst])
- return a_oclass[n_currst];
-}
-
-// ------------------------------------------------------------------------------------------
-// updates status bar message of the browser
-// ------------------------------------------------------------------------------------------
-function mitem_upstatus (b_clear) {
- window.setTimeout("window.status=unescape('" + (b_clear
- ? ''
- : (this.a_config[2] && this.a_config[2]['sb']
- ? escape(this.a_config[2]['sb'])
- : escape(this.a_config[0]) + (this.a_config[1]
- ? ' ('+ escape(this.a_config[1]) + ')'
- : ''))) + "')", 10);
-}
-
-// --------------------------------------------------------------------------------
-// that's all folks
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+
+// Title: tigra menu
+// Description: See the demo at url
+// URL: http://www.softcomplex.com/products/tigra_menu/
+// Version: 2.0 (commented source)
+// Date: 04-05-2003 (mm-dd-yyyy)
+// Tech. Support: http://www.softcomplex.com/forum/forumdisplay.php?fid=40
+// Notes: This script is free. Visit official site for further details.
+// This script adapted by Eugene Grigorjev for using as popup menu
+// of ZABBIX software. See http://www.zabbix.com.
+//debugger;
+
+function show_popup_menu(e, content, width)
+{
+ if(!width) width = 170;
+
+ var pos = [
+ {'block_top': -12, 'block_left': -5, 'width': width},
+ {'block_top': 5, 'block_left': width-5, 'width': width}
+ ];
+
+ var cursor = get_cursor_position(e);
+
+ new popup_menu (content, pos, cursor.x, cursor.y);
+
+ return false;
+}
+
+// --------------------------------------------------------------------------------
+// global collection containing all menus on current page
+var A_MENUS = [];
+
+// --------------------------------------------------------------------------------
+// menu class
+function popup_menu (a_items, a_tpl, x, y) {
+
+ // browser check
+ if (!document.body || !document.body.style)
+ return;
+
+ this.n_scroll_left = get_scroll_pos()[0];
+ this.n_scroll_top = get_scroll_pos()[1];
+
+ if(document.body.clientWidth)
+ {
+ this.n_scr_width = document.body.clientWidth;
+ this.n_scr_height = document.body.clientHeight;
+ }
+ else
+ {
+ this.n_scr_width = document.width;
+ this.n_scr_height = document.height;
+ }
+
+ // store items structure
+ this.a_config = a_items;
+
+ // store template structure
+ this.a_tpl = a_tpl;
+
+ // get menu id
+ this.n_id = A_MENUS.length;
+
+ // declare collections
+ this.a_index = [];
+ this.a_children = [];
+
+ // assigh methods and event handlers
+ this.expand = menu_expand;
+ this.collapse = menu_collapse;
+
+ this.onclick = menu_onclick;
+ this.onmouseout = menu_onmouseout;
+ this.onmouseover = menu_onmouseover;
+ this.onmousedown = menu_onmousedown;
+
+ this.getstyle = mitem_getstyle;
+
+ this.set_x_direction = mitem_set_x_direction;
+ this.get_x_direction = mitem_get_x_direction;
+ this.set_y_direction = mitem_set_y_direction;
+ this.get_y_direction = mitem_get_y_direction;
+
+ // default level scope description structure
+ this.a_tpl_def = {
+ 'block_top' : 0,
+ 'block_left' : 0,
+ 'top' : 23,
+ 'left' : 0,
+ 'width' : 170,
+ 'height' : 24,
+ 'hide_delay' : 200,
+ 'expd_delay' : 200
+ };
+
+ /* default css */
+ this.a_css_def = {
+ 'outer' : ['pum_o_item'],
+ 'inner' : ['pum_i_item']
+ };
+
+
+ // assign methods and properties required to imulate parent item
+ this.getprop = function (s_key) {
+ return this.a_tpl_def[s_key];
+ };
+
+ this.o_root = this;
+ this.n_depth = -1;
+ this.n_x = x;
+ this.n_y = y;
+
+ // init items recursively
+ for (n_order = 0; n_order < a_items.length; n_order++)
+ new menu_item(this, n_order);
+
+ // register self in global collection
+ A_MENUS[this.n_id] = this;
+
+ // make root level visible
+ for (var n_order = 0; n_order < this.a_children.length; n_order++)
+ this.a_children[n_order].e_oelement.style.visibility = 'visible';
+}
+
+// --------------------------------------------------------------------------------
+function mitem_set_x_direction(n_val) {
+ this.n_x_direction = n_val;
+}
+
+function mitem_get_x_direction() {
+ return (this.n_x_direction ? this.n_x_direction : null);
+}
+
+function mitem_set_y_direction(n_val) {
+ this.n_y_direction = n_val;
+}
+
+function mitem_get_y_direction() {
+ return (this.n_y_direction ? this.n_y_direction : null);
+}
+
+// --------------------------------------------------------------------------------
+function menu_collapse (n_id) {
+ // cancel item open delay
+ clearTimeout(this.o_showtimer);
+
+ // by default collapse all levels
+ var n_tolevel = (n_id ? this.a_index[n_id].n_depth : -1);
+ if(-1 == n_tolevel){
+ for (n_id = 0; n_id < this.a_index.length; n_id++){
+ var o_curritem = this.a_index[n_id];
+ if(o_curritem){
+ var e_oelement = document.getElementById(o_curritem.e_oelement.id);
+ if(e_oelement != null){
+ document.body.removeChild(e_oelement);
+ }
+ }
+ }
+ A_MENUS.splice(this.o_root.n_id);
+ } else {
+ // hide all items over the level specified
+ for (n_id = 0; n_id < this.a_index.length; n_id++) {
+ var o_curritem = this.a_index[n_id];
+ if (o_curritem && o_curritem.n_depth > n_tolevel && o_curritem.b_visible) {
+ o_curritem.e_oelement.style.visibility = 'hidden';
+ o_curritem.b_visible = false;
+ }
+ }
+ }
+
+ // reset current item if mouse has gone out of items
+ if (!n_id) this.o_current = null;
+}
+
+// --------------------------------------------------------------------------------
+function menu_expand (n_id) {
+
+ // expand only when mouse is over some menu item
+ if (this.o_hidetimer)
+ return;
+
+ // lookup current item
+ var o_item = this.a_index[n_id];
+
+ // close previously opened items
+ if (this.o_current && this.o_current.n_depth >= o_item.n_depth)
+ this.collapse(o_item.n_id);
+ this.o_current = o_item;
+
+ // exit if there are no children to open
+ if (!o_item.a_children)
+ return;
+
+ // show direct child items
+ for (var n_order = 0; n_order < o_item.a_children.length; n_order++) {
+ var o_curritem = o_item.a_children[n_order];
+ o_curritem.e_oelement.style.visibility = 'visible';
+ o_curritem.b_visible = true;
+ }
+}
+
+// --------------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------------
+function menu_onclick (n_id) {
+ // don't go anywhere if item has no link defined
+ // lookup new item's object
+ if(Boolean(this.a_index[n_id].a_config[1])){
+ // lookup new item's object
+ var o_item = this.a_index[n_id];
+
+ // apply rollout
+ o_item.e_oelement.className = o_item.getstyle(0, 0);
+ o_item.e_ielement.className = o_item.getstyle(1, 0);
+
+ // update status line
+ o_item.upstatus(7);
+
+ this.o_hidetimer = setTimeout('A_MENUS['+ this.n_id +'].collapse();', 100);//o_item.getprop('hide_delay'));
+ //this.collapse();
+ //alert(A_MENUS[this.n_id].a_config[1][1]);
+ return true;
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------------------
+function menu_onmouseout (n_id) {
+
+ // lookup new item's object
+ var o_item = this.a_index[n_id];
+
+ // apply rollout
+ o_item.e_oelement.className = o_item.getstyle(0, 0);
+ o_item.e_ielement.className = o_item.getstyle(1, 0);
+
+ // update status line
+ o_item.upstatus(7);
+
+ // run mouseover timer
+ this.o_hidetimer = setTimeout('A_MENUS['+ this.n_id +'].collapse();', o_item.getprop('hide_delay'));
+}
+
+// --------------------------------------------------------------------------------
+function menu_onmouseover (n_id) {
+
+ // cancel mouseoute menu close and item open delay
+ clearTimeout(this.o_hidetimer);
+ this.o_hidetimer = null;
+ clearTimeout(this.o_showtimer);
+
+ // lookup new item's object
+ var o_item = this.a_index[n_id];
+
+ // update status line
+ o_item.upstatus();
+
+ // apply rollover
+ o_item.e_oelement.className = o_item.getstyle(0, 1);
+ o_item.e_ielement.className = o_item.getstyle(1, 1);
+
+ // if onclick open is set then no more actions required
+ if (o_item.getprop('expd_delay') < 0)
+ return;
+
+ // run expand timer
+ this.o_showtimer = setTimeout('A_MENUS['+ this.n_id +'].expand(' + n_id + ');',
+ o_item.getprop('expd_delay'));
+
+}
+
+// --------------------------------------------------------------------------------
+// called when mouse button is pressed on menu item
+// --------------------------------------------------------------------------------
+function menu_onmousedown (n_id) {
+ // lookup new item's object
+ var o_item = this.a_index[n_id];
+
+ // apply mouse down style
+ o_item.e_oelement.className = o_item.getstyle(0, 2);
+ o_item.e_ielement.className = o_item.getstyle(1, 2);
+
+ this.expand(n_id);
+// this.items[id].switch_style('onmousedown');
+}
+
+
+// --------------------------------------------------------------------------------
+// menu item Class
+
+function menu_item (o_parent, n_order) {
+
+ // store parameters passed to the constructor
+ this.n_depth = o_parent.n_depth + 1;
+
+ var item_offset = this.n_depth ? 4 : 0;
+ this.a_config = o_parent.a_config[n_order + item_offset];
+
+ // return if required parameters are missing
+ if (!this.a_config || !this.a_config[0])
+ {
+ return;
+ }
+
+ // store info from parent item
+ this.o_root = o_parent.o_root;
+ this.o_parent = o_parent;
+ this.n_order = n_order;
+
+ // register in global and parent's collections
+ this.n_id = this.o_root.a_index.length + 1;
+ this.o_root.a_index[this.n_id] = this;
+ o_parent.a_children[n_order] = this;
+
+ // calculate item's coordinates
+ var o_root = this.o_root,
+ a_tpl = this.o_root.a_tpl;
+
+ this.a_css = this.a_config[3] ? this.a_config[3] : null;
+
+ // assign methods
+ this.getprop = mitem_getprop;
+ this.getstyle = mitem_getstyle;
+ this.upstatus = mitem_upstatus;
+
+ this.set_x_direction = mitem_set_x_direction;
+ this.get_x_direction = mitem_get_x_direction;
+ this.set_y_direction = mitem_set_y_direction;
+ this.get_y_direction = mitem_get_y_direction;
+
+ if(!o_parent.n_x_direction && !n_order)
+ {
+ // calculate menu direction in first element
+ o_parent.set_x_direction(
+ (this.getprop('width') + o_parent.n_x + this.getprop('block_left')
+ > o_root.n_scr_width + o_root.n_scroll_left)
+ ? -1 : 1
+ );
+ }
+
+ this.n_x = n_order
+ ? o_parent.a_children[n_order - 1].n_x + this.getprop('left') * o_parent.get_x_direction()
+ : o_parent.n_x + this.getprop('block_left') * o_parent.get_x_direction();
+
+ if(-1 == o_parent.get_x_direction() && o_parent == o_root && !n_order)
+ {
+ this.n_x -= this.getprop('width');
+ }
+
+ if(!o_parent.n_y_direction && !n_order)
+ {
+ //alert("w: " +this.getprop('height') +" i:" + (o_parent.a_config.length - item_offset) );
+ // calculate menu direction in first element
+ o_parent.set_y_direction(
+ (this.getprop('height') * (o_parent.a_config.length - item_offset) + o_parent.n_y + this.getprop('block_top')
+ > o_root.n_scr_height + o_root.n_scroll_top)
+ ? -1 : 1
+ );
+ }
+
+ this.n_y = n_order
+ ? o_parent.a_children[n_order - 1].n_y + this.getprop('top')
+ : o_parent.n_y + this.getprop('block_top') * (o_parent == o_root ? o_parent.get_y_direction() : 1);
+
+ if(-1 == o_parent.get_y_direction() && !n_order)
+ {
+ this.n_y -= this.getprop('height') * (o_parent.a_config.length - item_offset);
+ }
+
+ // generate item's HMTL
+ var el = document.createElement("a");
+ el.setAttribute('id', 'e' + o_root.n_id + '_' + this.n_id + 'o');
+ el.setAttribute('href', this.a_config[1]);
+
+ if(this.a_config[2] && this.a_config[2]['tw'])
+ el.setAttribute('target', this.a_config[2]['tw']);
+
+ el.className = this.getstyle(0, 0);
+ el.style.position = 'absolute';
+ el.style.top = this.n_y + 'px';
+ el.style.left = this.n_x + 'px';
+ el.style.width = this.getprop('width') + 'px';
+ el.style.height = this.getprop('height') + 'px';
+ el.style.visibility = 'hidden';
+ el.style.zIndex = this.n_depth;
+
+ el.o_root_n_id = o_root.n_id;
+ el.this_n_id = this.n_id;
+
+ el.onclick = A_MENUS_onclick;
+ el.onmouseout = A_MENUS_onmouseout;
+ el.onmouseover = A_MENUS_onmouseover;
+ el.onmousedown = A_MENUS_onmousedown;
+
+ el.innerHTML = '<div id="e' + o_root.n_id + '_' + this.n_id +'i" class="' + this.getstyle(1, 0) + '">' + this.a_config[0] + '</div>';
+// console.log(el,el.innerHTML);
+ document.body.appendChild(el);
+
+ this.e_ielement = document.getElementById('e' + o_root.n_id + '_' + this.n_id + 'i');
+ this.e_oelement = document.getElementById('e' + o_root.n_id + '_' + this.n_id + 'o');
+
+ this.b_visible = !this.n_depth;
+
+ // no more initialization if leaf
+ if (this.a_config.length < item_offset)
+ return;
+
+ // node specific methods and properties
+ this.a_children = [];
+
+ // init downline recursively
+ for (var n_order = 0; n_order < this.a_config.length - item_offset; n_order++)
+ new menu_item(this, n_order);
+}
+
+function A_MENUS_onclick(){ return A_MENUS[this.o_root_n_id].onclick(this.this_n_id); }
+function A_MENUS_onmouseout(){ return A_MENUS[this.o_root_n_id].onmouseout(this.this_n_id); }
+function A_MENUS_onmouseover(){ return A_MENUS[this.o_root_n_id].onmouseover(this.this_n_id); }
+function A_MENUS_onmousedown(){ return A_MENUS[this.o_root_n_id].onmousedown(this.this_n_id); }
+
+// --------------------------------------------------------------------------------
+// reads property from template file, inherits from parent level if not found
+// ------------------------------------------------------------------------------------------
+function mitem_getprop (s_key) {
+
+ // check if value is defined for current level
+ var s_value = null,
+ a_level = this.o_root.a_tpl[this.n_depth];
+
+ // return value if explicitly defined
+ if (a_level)
+ s_value = a_level[s_key];
+
+ // request recursively from parent levels if not defined
+ return (s_value == null ? this.o_parent.getprop(s_key) : s_value);
+}
+// --------------------------------------------------------------------------------
+// reads property from template file, inherits from parent level if not found
+// ------------------------------------------------------------------------------------------
+function mitem_getstyle (n_pos, n_state) {
+
+ var a_css = this.a_css;
+
+ // request recursively from parent levels if not defined
+ if(!a_css)
+ a_css = this.o_root.a_css_def;
+
+ //var a_css = this.o_root.a_css;
+
+ var a_oclass = a_css[n_pos ? 'inner' : 'outer'];
+
+ // same class for all states
+ if (typeof(a_oclass) == 'string')
+ return a_oclass;
+
+
+ // inherit class from previous state if not explicitly defined
+ for (var n_currst = n_state; n_currst >= 0; n_currst--){
+ if(a_oclass[n_currst]) return a_oclass[n_currst];
+ }
+}
+
+// ------------------------------------------------------------------------------------------
+// updates status bar message of the browser
+// ------------------------------------------------------------------------------------------
+function mitem_upstatus (b_clear) {
+ window.setTimeout("window.status=unescape('" + (b_clear
+ ? ''
+ : (this.a_config[2] && this.a_config[2]['sb']
+ ? escape(this.a_config[2]['sb'])
+ : escape(this.a_config[0]) + (this.a_config[1]
+ ? ' ('+ escape(this.a_config[1]) + ')'
+ : ''))) + "')", 10);
+}
+
+// --------------------------------------------------------------------------------
+// that's all folks
diff --git a/frontends/php/styles/div.css b/frontends/php/styles/div.css
index b77ecb38..af66ab97 100644
--- a/frontends/php/styles/div.css
+++ b/frontends/php/styles/div.css
@@ -53,3 +53,6 @@ span.green{
span.red{
color: #AA0000;
}
+span.orange{
+ color: #EE6000;
+}
diff --git a/frontends/php/styles/link.css b/frontends/php/styles/link.css
index 34734f7b..7d4d35c1 100644
--- a/frontends/php/styles/link.css
+++ b/frontends/php/styles/link.css
@@ -17,6 +17,11 @@ A.disabled:visited { color:#AA0000; text-decoration: none; }
A.disabled:hover { color:#AA0000; text-decoration: underline; }
A.disabled:active { color:#AA0000; text-decoration: underline;}
+A.orange:link { color:#EE7000; text-decoration: none; }
+A.orange:visited { color:#EE7000; text-decoration: none; }
+A.orange:hover { color:#EE7000; text-decoration: underline; }
+A.orange:active { color:#EE7000; text-decoration: underline;}
+
A.unknown:link { color:#AAAAAA; text-decoration: none; }
A.unknown:visited { color:#AAAAAA; text-decoration: none; }
A.unknown:hover { color:#AAAAAA; text-decoration: underline; }
diff --git a/frontends/php/users.php b/frontends/php/users.php
index 99c57be7..ab0e3eff 100644
--- a/frontends/php/users.php
+++ b/frontends/php/users.php
@@ -24,6 +24,7 @@
require_once "include/media.inc.php";
require_once "include/users.inc.php";
require_once "include/forms.inc.php";
+ require_once "include/js.inc.php";
$page["title"] = "S_USERS";
$page["file"] = "users.php";
@@ -39,114 +40,118 @@ include_once "include/page_header.php";
<?php
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
- "config"=> array(T_ZBX_INT, O_OPT, null, IN("0,1"), null),
- "perm_details"=>array(T_ZBX_INT, O_OPT, null, IN("0,1"), null),
+ 'config'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), null),
+ 'perm_details'=>array(T_ZBX_INT, O_OPT, null, IN('0,1'), null),
/* user */
- "userid"=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID,'(isset({config})&&({config}==0))&&(isset({form})&&({form}=="update"))'),
- "group_userid"=>array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
+ 'userid'=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID,'(isset({config})&&({config}==0))&&(isset({form})&&({form}=="update"))'),
+ 'group_userid'=>array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
- "alias"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
- "name"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
- "surname"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
- "password1"=> array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})&&(isset({form})&&({form}!="update"))&&isset({change_password})'),
+ 'alias'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
+ 'name'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
+ 'surname'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
+ 'password1'=> array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})&&(isset({form})&&({form}!="update"))&&isset({change_password})'),
"password2"=> array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})&&(isset({form})&&({form}!="update"))&&isset({change_password})'),
- "user_type"=> array(T_ZBX_INT, O_OPT, null, IN('1,2,3'), '(isset({config})&&({config}==0))&&isset({save})'),
- "user_groups"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
- "user_groups_to_del"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null),
- "user_medias"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null),
- "user_medias_to_del"=> array(T_ZBX_STR, O_OPT, null, DB_ID, null),
- "new_group"=> array(T_ZBX_STR, O_OPT, null, null, null),
- "new_media"=> array(T_ZBX_STR, O_OPT, null, null, null),
- "enable_media"=>array(T_ZBX_INT, O_OPT, null, null, null),
- "disable_media"=>array(T_ZBX_INT, O_OPT,null, null, null),
- "lang"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
- "autologout"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,3600),'(isset({config})&&({config}==0))&&isset({save})'),
- "url"=> array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})'),
- "refresh"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,3600),'(isset({config})&&({config}==0))&&isset({save})'),
- "set_status"=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), null),
- "status"=> array(T_ZBX_INT, O_OPT, null, IN('0,1'),'(isset({config})&&({config}==0))&&isset({save})'),
-
- "right"=> array(T_ZBX_STR, O_NO, null, NOT_EMPTY,
+ 'user_type'=> array(T_ZBX_INT, O_OPT, null, IN('1,2,3'), '(isset({config})&&({config}==0))&&isset({save})'),
+ 'user_groups'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
+ 'user_groups_to_del'=> array(T_ZBX_INT, O_OPT, null, DB_ID, null),
+ 'user_medias'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null),
+ 'user_medias_to_del'=> array(T_ZBX_STR, O_OPT, null, DB_ID, null),
+ 'new_group'=> array(T_ZBX_STR, O_OPT, null, null, null),
+ 'new_media'=> array(T_ZBX_STR, O_OPT, null, null, null),
+ 'enable_media'=>array(T_ZBX_INT, O_OPT, null, null, null),
+ 'disable_media'=>array(T_ZBX_INT, O_OPT,null, null, null),
+ 'lang'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==0))&&isset({save})'),
+ 'autologout'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,3600),'(isset({config})&&({config}==0))&&isset({save})'),
+ 'url'=> array(T_ZBX_STR, O_OPT, null, null, '(isset({config})&&({config}==0))&&isset({save})'),
+ 'refresh'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,3600),'(isset({config})&&({config}==0))&&isset({save})'),
+
+ 'right'=> array(T_ZBX_STR, O_NO, null, NOT_EMPTY,
'(isset({register})&&({register}=="add permission"))&&isset({userid})'),
- "permission"=> array(T_ZBX_STR, O_NO, null, NOT_EMPTY,
+ 'permission'=> array(T_ZBX_STR, O_NO, null, NOT_EMPTY,
'(isset({register})&&({register}=="add permission"))&&isset({userid})'),
- "id"=> array(T_ZBX_INT, O_NO, null, DB_ID,
+ 'id'=> array(T_ZBX_INT, O_NO, null, DB_ID,
'(isset({register})&&({register}=="add permission"))&&isset({userid})'),
- "rightid"=> array(T_ZBX_INT, O_NO, null, DB_ID,
+ 'rightid'=> array(T_ZBX_INT, O_NO, null, DB_ID,
'(isset({register})&&({register}=="delete permission"))&&isset({userid})'),
+ 'grpaction'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), null),
/* group */
- "usrgrpid"=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID,'(isset({config})&&({config}==1))&&(isset({form})&&({form}=="update"))'),
- "group_groupid"=>array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
-
- "gname"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==1))&&isset({save})'),
- "users"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
- "new_right"=> array(T_ZBX_STR, O_OPT, null, null, null),
- "new_user"=> array(T_ZBX_STR, O_OPT, null, null, null),
- "right_to_del"=>array(T_ZBX_STR, O_OPT, null, null, null),
- "group_users_to_del"=> array(T_ZBX_STR, O_OPT, null, null, null),
- "group_users"=> array(T_ZBX_STR, O_OPT, null, null, null),
- "group_rights"=>array(T_ZBX_STR, O_OPT, null, null, null),
+ 'usrgrpid'=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID,'(isset({config})&&(({config}==1) || isset({grpaction})))&&(isset({form})&&({form}=="update"))'),
+ 'group_groupid'=>array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
+
+ 'gname'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({config})&&({config}==1))&&isset({save})'),
+ 'users'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
+ 'users_status'=>array(T_ZBX_INT, O_OPT, null, IN('0,1'), '(isset({config})&&({config}==1))&&isset({save})'),
+ 'gui_access'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), '(isset({config})&&({config}==1))&&isset({save})'),
+ 'new_right'=> array(T_ZBX_STR, O_OPT, null, null, null),
+ 'new_user'=> array(T_ZBX_STR, O_OPT, null, null, null),
+ 'right_to_del'=>array(T_ZBX_STR, O_OPT, null, null, null),
+ 'group_users_to_del'=> array(T_ZBX_STR, O_OPT, null, null, null),
+ 'group_users'=> array(T_ZBX_STR, O_OPT, null, null, null),
+ 'group_rights'=>array(T_ZBX_STR, O_OPT, null, null, null),
+
+ 'set_users_status'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), null),
+ 'set_gui_access'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), null),
/* actions */
- "register"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT,
+ 'register'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT,
IN('"add permission","delete permission"'), null),
- "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "delete_selected"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "del_user_group"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "del_user_media"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'save'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'delete'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'delete_selected'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'del_user_group'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'del_user_media'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "del_read_only"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "del_read_write"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "del_deny"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'del_read_only'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'del_read_write'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'del_deny'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "del_group_user"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'del_group_user'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "add_read_only"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "add_read_write"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "add_deny"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'add_read_only'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'add_read_write'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'add_deny'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "change_password"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
- "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null),
+ 'change_password'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ 'cancel'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null),
/* other */
- "form"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null),
- "form_refresh"=>array(T_ZBX_STR, O_OPT, null, null, null)
+ 'form'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null),
+ 'form_refresh'=>array(T_ZBX_STR, O_OPT, null, null, null)
);
check_fields($fields);
- validate_sort_and_sortorder();
+ validate_sort_and_sortorder();
?>
<?php
- if($_REQUEST["config"]==0)
+ if($_REQUEST['config']==0)
{
- if(isset($_REQUEST["new_group"]))
+ if(isset($_REQUEST['new_group']))
{
$_REQUEST['user_groups'] = get_request('user_groups', array());
foreach($_REQUEST['new_group'] as $id => $val)
$_REQUEST['user_groups'][$id] = $val;
}
- elseif(isset($_REQUEST["new_media"]))
+ elseif(isset($_REQUEST['new_media']))
{
- $_REQUEST["user_medias"] = get_request('user_medias', array());
- array_push($_REQUEST["user_medias"], $_REQUEST["new_media"]);
+ $_REQUEST['user_medias'] = get_request('user_medias', array());
+ array_push($_REQUEST['user_medias'], $_REQUEST['new_media']);
}
- elseif(isset($_REQUEST["user_medias"]) && isset($_REQUEST["enable_media"]))
+ elseif(isset($_REQUEST['user_medias']) && isset($_REQUEST['enable_media']))
{
- if(isset($_REQUEST["user_medias"][$_REQUEST["enable_media"]]))
+ if(isset($_REQUEST['user_medias'][$_REQUEST['enable_media']]))
{
- $_REQUEST["user_medias"][$_REQUEST["enable_media"]]['active'] = 0;
+ $_REQUEST['user_medias'][$_REQUEST['enable_media']]['active'] = 0;
}
}
- elseif(isset($_REQUEST["user_medias"]) && isset($_REQUEST["disable_media"]))
+ elseif(isset($_REQUEST['user_medias']) && isset($_REQUEST['disable_media']))
{
- if(isset($_REQUEST["user_medias"][$_REQUEST["disable_media"]]))
+ if(isset($_REQUEST['user_medias'][$_REQUEST['disable_media']]))
{
- $_REQUEST["user_medias"][$_REQUEST["disable_media"]]['active'] = 1;
+ $_REQUEST['user_medias'][$_REQUEST['disable_media']]['active'] = 1;
}
}
- elseif(isset($_REQUEST["save"]))
+ elseif(isset($_REQUEST['save']))
{
$user_groups = get_request('user_groups', array());
$user_medias = get_request('user_medias', array());
@@ -173,7 +178,7 @@ include_once "include/page_header.php";
$result=update_user($_REQUEST["userid"],
$_REQUEST["name"],$_REQUEST["surname"],$_REQUEST["alias"],
$_REQUEST["password1"],$_REQUEST["url"],$_REQUEST["autologout"],
- $_REQUEST["lang"],$_REQUEST["refresh"],$_REQUEST["user_type"],$_REQUEST['status'],
+ $_REQUEST["lang"],$_REQUEST["refresh"],$_REQUEST["user_type"],
$user_groups, $user_medias);
show_messages($result, S_USER_UPDATED, S_CANNOT_UPDATE_USER);
@@ -182,7 +187,7 @@ include_once "include/page_header.php";
$result=add_user(
$_REQUEST["name"],$_REQUEST["surname"],$_REQUEST["alias"],
$_REQUEST["password1"],$_REQUEST["url"],$_REQUEST["autologout"],
- $_REQUEST["lang"],$_REQUEST["refresh"],$_REQUEST["user_type"],$_REQUEST['status'],
+ $_REQUEST["lang"],$_REQUEST["refresh"],$_REQUEST["user_type"],
$user_groups, $user_medias);
show_messages($result, S_USER_ADDED, S_CANNOT_ADD_USER);
@@ -251,23 +256,43 @@ include_once "include/page_header.php";
unset($_REQUEST["form"]);
}
}
- elseif(isset($_REQUEST["set_status"])&&isset($_REQUEST["userid"]))
+// Add USER to GROUP
+ elseif(isset($_REQUEST['grpaction'])&&isset($_REQUEST['usrgrpid'])&&isset($_REQUEST['userid'])&&($_REQUEST['grpaction']==1))
{
$user=get_user_by_userid($_REQUEST["userid"]);
- $result=change_user_status($_REQUEST["userid"],$_REQUEST['set_status']);
+ $group=get_group_by_usrgrpid($_REQUEST["usrgrpid"]);
+
+ $result=add_user_to_group($_REQUEST['userid'],$_REQUEST['usrgrpid']);
- $status_msg1 = ($_REQUEST['set_status'] == USER_STATUS_ENABLED)?S_ENABLED:S_DISABLED;
- $status_msg2 = ($_REQUEST['set_status'] == USER_STATUS_ENABLED)?S_ENABLE:S_DISABLE;
- show_messages($result, S_USER.SPACE.$status_msg1, S_CANNOT.SPACE.$status_msg2.SPACE.S_USER);
+ show_messages($result, S_USER_UPDATED, S_CANNOT_UPDATE_USER);
if($result){
- $audit_action = ($_REQUEST['set_status'] == USER_STATUS_ENABLED)?AUDIT_ACTION_ENABLE:AUDIT_ACTION_DISABLE;
- add_audit($audit_action,AUDIT_RESOURCE_USER,
- "User alias [".$user["alias"]."] name [".$user["name"]."] surname [".
- $user["surname"]."]");
+ add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_USER,
+ "User alias [".$user["alias"]."] name [".$user["name"]."] surname [".$user["surname"]."]");
+
+ unset($_REQUEST["usrgrpid"]);
+ unset($_REQUEST["userid"]);
+ }
+ unset($_REQUEST['grpaction']);
+ unset($_REQUEST["form"]);
+ }
+// Remove USER from GROUP
+ elseif(isset($_REQUEST['grpaction'])&&isset($_REQUEST['usrgrpid'])&&isset($_REQUEST['userid'])&&($_REQUEST['grpaction']==0))
+ {
+ $user=get_user_by_userid($_REQUEST["userid"]);
+ $group=get_group_by_usrgrpid($_REQUEST["usrgrpid"]);
+
+ $result=remove_user_from_group($_REQUEST['userid'],$_REQUEST['usrgrpid']);
+
+ show_messages($result, S_USER_UPDATED, S_CANNOT_UPDATE_USER);
+ if($result){
+ add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_USER,
+ "User alias [".$user["alias"]."] name [".$user["name"]."] surname [".$user["surname"]."]");
+ unset($_REQUEST["usrgrpid"]);
unset($_REQUEST["userid"]);
}
- unset($_REQUEST['form']);
+ unset($_REQUEST['grpaction']);
+ unset($_REQUEST["form"]);
}
}
else /* config == 1 */
@@ -326,11 +351,11 @@ include_once "include/page_header.php";
if(isset($_REQUEST["usrgrpid"])){
$action = AUDIT_ACTION_UPDATE;
- $result=update_user_group($_REQUEST["usrgrpid"], $_REQUEST["gname"], $group_users, $group_rights);
+ $result=update_user_group($_REQUEST["usrgrpid"], $_REQUEST["gname"], $_REQUEST['users_status'], $_REQUEST['gui_access'], $group_users, $group_rights);
show_messages($result, S_GROUP_UPDATED, S_CANNOT_UPDATE_GROUP);
}else{
$action = AUDIT_ACTION_ADD;
- $result=add_user_group($_REQUEST["gname"], $group_users, $group_rights);
+ $result=add_user_group($_REQUEST["gname"], $_REQUEST['users_status'], $_REQUEST['gui_access'], $group_users, $group_rights);
show_messages($result, S_GROUP_ADDED, S_CANNOT_ADD_GROUP);
}
@@ -370,6 +395,40 @@ include_once "include/page_header.php";
unset($_REQUEST["form"]);
}
}
+ elseif(isset($_REQUEST['set_gui_access'])&&isset($_REQUEST['usrgrpid']))
+ {
+ $group=get_group_by_usrgrpid($_REQUEST["usrgrpid"]);
+ $result=change_group_gui_access($_REQUEST["usrgrpid"],$_REQUEST['set_gui_access']);
+
+ $status_msg1 = ($_REQUEST['set_gui_access'] == GROUP_GUI_ACCESS_ENABLED)?S_ENABLED:S_DISABLED;
+ $status_msg2 = ($_REQUEST['set_gui_access'] == GROUP_GUI_ACCESS_ENABLED)?S_ENABLE:S_DISABLE;
+
+ show_messages($result, S_GROUP.SPACE.'"'.$group['name'].'"'.SPACE.S_GUI_ACCESS.SPACE.$status_msg1, S_CANNOT.SPACE.$status_msg2.SPACE.S_GROUP);
+ if($result){
+ $audit_action = ($_REQUEST['set_gui_access'] == GROUP_GUI_ACCESS_ENABLED)?AUDIT_ACTION_ENABLE:AUDIT_ACTION_DISABLE;
+ add_audit($audit_action,AUDIT_RESOURCE_USER_GROUP,'GUI access for group name ['.$group['name'].']');
+
+ unset($_REQUEST["usrgrpid"]);
+ }
+ unset($_REQUEST['form']);
+ }
+ elseif(isset($_REQUEST["set_users_status"])&&isset($_REQUEST["usrgrpid"]))
+ {
+ $group=get_group_by_usrgrpid($_REQUEST["usrgrpid"]);
+ $result=change_group_status($_REQUEST["usrgrpid"],$_REQUEST['set_users_status']);
+
+ $status_msg1 = ($_REQUEST['set_users_status'] == GROUP_STATUS_ENABLED)?S_ENABLED:S_DISABLED;
+ $status_msg2 = ($_REQUEST['set_users_status'] == GROUP_STATUS_ENABLED)?S_ENABLE:S_DISABLE;
+
+ show_messages($result, S_GROUP.SPACE.'"'.$group['name'].'"'.SPACE.$status_msg1, S_CANNOT.SPACE.$status_msg2.SPACE.S_GROUP);
+ if($result){
+ $audit_action = ($_REQUEST['set_users_status'] == GROUP_STATUS_ENABLED)?AUDIT_ACTION_ENABLE:AUDIT_ACTION_DISABLE;
+ add_audit($audit_action,AUDIT_RESOURCE_USER_GROUP,'Group name ['.$group['name'].']');
+
+ unset($_REQUEST["usrgrpid"]);
+ }
+ unset($_REQUEST['form']);
+ }
}
?>
<?php
@@ -410,10 +469,12 @@ include_once "include/page_header.php";
make_sorting_link(S_USER_TYPE,'u.type'),
S_GROUPS,
S_IS_ONLINE_Q,
- S_STATUS
+ S_GUI_ACCESS,
+ S_STATUS,
+ S_ACTIONS
));
- $db_users=DBselect('SELECT u.userid,u.alias,u.name,u.surname,u.type,u.autologout,u.status '.
+ $db_users=DBselect('SELECT u.userid,u.alias,u.name,u.surname,u.type,u.autologout '.
' FROM users u'.
' WHERE '.DBin_node('u.userid').
order_by('u.alias,u.name,u.surname,u.type','u.userid'));
@@ -438,19 +499,25 @@ include_once "include/page_header.php";
while($db_group = DBfetch($db_groups))
array_push($user_groups,empty($user_groups)?'':BR(),$db_group['name']);
- $status = ($db_user['status'] == USER_STATUS_ENABLED)?S_ENABLED:S_DISABLED;
- if((bccomp($USER_DETAILS['userid'],$db_user['userid']) != 0)){
- $status = new CLink($status,
- 'users.php?form=update'.
- '&set_status='.((int)(!$db_user['status'])).
- '&userid='.$db_user["userid"].
- url_param("config"),
- ($db_user['status'] == USER_STATUS_ENABLED)?'enabled':'disabled');
+
+ $db_user['users_status'] = check_perm2system($db_user['userid']);
+ $db_user['gui_access'] = check_perm2login($db_user['userid']);
+
+ $users_status = ($db_user['users_status'])?S_ENABLED:S_DISABLED;
+ $gui_access = ($db_user['gui_access'])?S_ENABLED:S_DISABLED;
+
+ $gui_access = new CSpan($gui_access,($db_user['gui_access'])?'green':'orange');
+ $users_status = new CSpan($users_status,($db_user['users_status'])?'green':'red');
+
+ $action = get_user_actionmenu($db_user['userid']);
+/* if((bccomp($USER_DETAILS['userid'],$db_user['userid']) != 0)){
+ $action = get_user_actionmenu($db_user['userid']);
}
else{
- $status = new CSpan($status,($db_user['status'] == USER_STATUS_ENABLED)?'green':'red');
+ $action = new CSpan(S_SELECT);
+ $action->AddOption('style','color: #888888;');
}
-
+//*/
$table->addRow(array(
array(
new CCheckBox("group_userid[".$db_user["userid"]."]",NULL,NULL,$db_user["userid"]),
@@ -463,13 +530,18 @@ include_once "include/page_header.php";
user_type2str($db_user['type']),
$user_groups,
$online,
- $status
+ $gui_access,
+ $users_status,
+ $action
));
}
$table->SetFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
$form->AddItem($table);
$form->show();
+
+ $jsmenu = new CPUMenu(null,270);
+ $jsmenu->InsertJavaScript();
}
}
elseif($_REQUEST["config"]==1)
@@ -488,15 +560,19 @@ include_once "include/page_header.php";
array( new CCheckBox("all_groups",NULL,
"CheckAll('".$form->GetName()."','all_groups');"),
make_sorting_link(S_NAME,'ug.name')),
- S_MEMBERS));
+ S_MEMBERS,
+ S_GUI_ACCESS,
+ S_USERS_STATUS
+ ));
- $result=DBselect('SELECT ug.usrgrpid, ug.name '.
+ $result=DBselect('SELECT ug.usrgrpid, ug.name, ug.users_status, ug.gui_access '.
' FROM usrgrp ug'.
' WHERE '.DBin_node('ug.usrgrpid').
order_by('ug.name'));
while($row=DBfetch($result))
{
$users = array();
+ $users_id = array();
$db_users=DBselect('SELECT DISTINCT u.alias,u.userid '.
' FROM users u,users_groups ug '.
@@ -504,8 +580,35 @@ include_once "include/page_header.php";
' AND ug.usrgrpid='.$row['usrgrpid'].
' ORDER BY u.alias');
- while($db_user=DBfetch($db_users)) $users[$db_user['userid']] = $db_user["alias"];
+ while($db_user=DBfetch($db_users)){
+ $users[$db_user['userid']] = $db_user['alias'];
+ }
+
+ $gui_access = ($row['gui_access'] == GROUP_GUI_ACCESS_ENABLED)?S_ENABLED:S_DISABLED;
+ $users_status = ($row['users_status'] == GROUP_STATUS_ENABLED)?S_ENABLED:S_DISABLED;
+
+ if(granted2update_group($row['usrgrpid'])){
+ $gui_access = new CLink($gui_access,
+ 'users.php?form=update'.
+ '&set_gui_access='.(($row['gui_access'] == GROUP_GUI_ACCESS_ENABLED)?GROUP_GUI_ACCESS_DISABLED:GROUP_GUI_ACCESS_ENABLED).
+ '&usrgrpid='.$row["usrgrpid"].
+ url_param("config"),
+
+ ($row['gui_access'] == GROUP_GUI_ACCESS_ENABLED)?'enabled':'orange');
+ $users_status = new CLink($users_status,
+ 'users.php?form=update'.
+ '&set_users_status='.(($row['users_status'] == GROUP_STATUS_ENABLED)?GROUP_STATUS_DISABLED:GROUP_STATUS_ENABLED).
+ '&usrgrpid='.$row["usrgrpid"].
+ url_param("config"),
+ ($row['users_status'] == GROUP_STATUS_ENABLED)?'enabled':'disabled');
+
+ }
+ else{
+ $gui_access = new CSpan($gui_access,($row['gui_access'] == GROUP_GUI_ACCESS_ENABLED)?'green':'orange');
+ $users_status = new CSpan($users_status,($row['users_status'] == GROUP_STATUS_ENABLED)?'green':'red');
+ }
+
$table->addRow(array(
array(
new CCheckBox("group_groupid[]",NULL,NULL,$row["usrgrpid"]),
@@ -513,7 +616,10 @@ include_once "include/page_header.php";
"users.php?form=update".url_param("config").
"&usrgrpid=".$row["usrgrpid"]."#form", 'action')
),
- implode(', ',$users)));
+ implode(', ',$users),
+ $gui_access,
+ $users_status
+ ));
}
$table->SetFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_GROUPS_Q)));