summaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-19 09:57:04 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-19 09:57:04 +0000
commit2804bdc7c298f114802a93d7c3312370c8602ba0 (patch)
treee64da99ddeba0db5afe0beea20efc46bd4bd202f /frontends
parent3a568d3f5e674426fe907fbfb81721994b4fe3db (diff)
downloadzabbix-2804bdc7c298f114802a93d7c3312370c8602ba0.tar.gz
zabbix-2804bdc7c298f114802a93d7c3312370c8602ba0.tar.xz
zabbix-2804bdc7c298f114802a93d7c3312370c8602ba0.zip
- [DEV-178] fixed the permissions scheme (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5781 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r--frontends/php/include/config.inc.php15
-rw-r--r--frontends/php/include/perm.inc.php11
2 files changed, 13 insertions, 13 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index adea212c..7ea70118 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -209,10 +209,11 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
global $USER_DETAILS,
$ZBX_LOCALNODEID, $ZBX_LOCMASTERID,
$ZBX_CURRENT_NODEID, $ZBX_CURRENT_SUBNODES, $ZBX_CURMASTERID,
- $ZBX_NODES,
+ $ZBX_NODES,$ZBX_NODES_IDS,
$ZBX_WITH_SUBNODES;
$ZBX_CURRENT_SUBNODES = array();
+ $ZBX_NODES_IDS = array();
$ZBX_NODES = array();
if(!defined('ZBX_PAGE_NO_AUTHERIZATION') && ZBX_DISTRIBUTED){
@@ -234,11 +235,11 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
$ZBX_CURMASTERID = $node_data['masterid'];
}
-// $ZBX_NODES = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST, PERM_RES_DATA_ARRAY);
-
- $sql = 'SELECT * FROM nodes';
+ $sql = 'SELECT nodeid,name,masterid FROM nodes';
$db_nodes = DBselect($sql);
+
while($node = DBfetch($db_nodes)){
+ $ZBX_NODES_IDS[$node['nodeid']] = $node['nodeid'];
$ZBX_NODES[$node['nodeid']] = $node;
}
@@ -255,11 +256,11 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
$curr_node = &$ZBX_NODES[$curr_node['masterid']];
}
- if(bccomp($curr_node['masterid'],$ZBX_CURRENT_NODEID) == 0 ){
+ if(bccomp($curr_node['masterid'],$ZBX_CURRENT_NODEID)==0){
$ZBX_CURRENT_SUBNODES[$nodeid] = $nodeid;
}
}
-
+
zbx_set_post_cookie('zbx_current_nodeid',$ZBX_CURRENT_NODEID);
zbx_set_post_cookie('zbx_with_subnodes',$ZBX_WITH_SUBNODES);
}
@@ -274,7 +275,7 @@ 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);
+ $ZBX_CURRENT_SUBNODES = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST, PERM_RES_IDS_ARRAY, $ZBX_CURRENT_SUBNODES);
}
function get_current_nodeid($forse_with_subnodes = null, $perm = null){
diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php
index 0a8538dd..17299831 100644
--- a/frontends/php/include/perm.inc.php
+++ b/frontends/php/include/perm.inc.php
@@ -397,13 +397,12 @@ COpt::counter_up('perm');
return $result;
}
-function get_accessible_nodes_by_user(&$user_data,$perm,$perm_res=null){
- global $ZBX_LOCALNODEID;
+function get_accessible_nodes_by_user(&$user_data,$perm,$perm_res=null,$nodeid=null){
+ global $ZBX_LOCALNODEID, $ZBX_NODES_IDS;
- $nodeid = get_current_nodeid(true);
-//SDI($nodeid);
+ if(is_null($nodeid)) $nodeid = $ZBX_NODES_IDS;
if(is_null($perm_res)) $perm_res=PERM_RES_STRING_LINE;
-
+
$userid =& $user_data['userid'];
$user_type =& $user_data['type'];
if(!isset($userid)) fatal_error('Incorrect user data in "get_accessible_nodes_by_user"');
@@ -415,7 +414,7 @@ function get_accessible_nodes_by_user(&$user_data,$perm,$perm_res=null){
//COpt::counter_up('perm');
if(USER_TYPE_SUPER_ADMIN == $user_type){
- $nodes = DBselect('SELECT nodeid FROM nodes');
+ $nodes = DBselect('SELECT nodeid FROM nodes WHERE '.DBcondition('nodeid',$nodeid));
while($node = DBfetch($nodes)){
$node_data[$node['nodeid']] = $node;
$node_data[$node['nodeid']]['permission'] = PERM_READ_WRITE;