summaryrefslogtreecommitdiffstats
path: root/frontends/php/srv_status.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-04 10:42:46 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-04 10:42:46 +0000
commita96322ba711caad8f6e3681ebf0e44f02853b23f (patch)
tree228204e2e7909b419210279d8bae87865988b24f /frontends/php/srv_status.php
parent4f6849b38d72481080471bb1842860f93fa86a88 (diff)
downloadzabbix-a96322ba711caad8f6e3681ebf0e44f02853b23f.tar.gz
zabbix-a96322ba711caad8f6e3681ebf0e44f02853b23f.tar.xz
zabbix-a96322ba711caad8f6e3681ebf0e44f02853b23f.zip
- improvements in permission check graphs & services (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5589 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/srv_status.php')
-rw-r--r--frontends/php/srv_status.php51
1 files changed, 25 insertions, 26 deletions
diff --git a/frontends/php/srv_status.php b/frontends/php/srv_status.php
index 46d10f5b..9e1ec539 100644
--- a/frontends/php/srv_status.php
+++ b/frontends/php/srv_status.php
@@ -63,20 +63,15 @@ include_once "include/page_header.php";
unset($_REQUEST["serviceid"]);
}
- $denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_MODE_LT);
+ $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
+ $available_triggers = get_accessible_triggers(PERM_READ_ONLY, null, get_current_nodeid());
if(isset($_REQUEST["serviceid"]) && $_REQUEST["serviceid"] > 0){
-
- if( !($service = DBfetch(DBselect('SELECT s.* '.
+ $sql = 'SELECT s.serviceid '.
' FROM services s '.
- ' LEFT JOIN triggers t ON s.triggerid=t.triggerid '.
- ' LEFT JOIN functions f ON t.triggerid=f.triggerid '.
- ' LEFT JOIN items i on f.itemid=i.itemid '.
- ' WHERE (i.hostid IS NULL OR i.hostid NOT IN ('.$denyed_hosts.')) '.
- ' AND '.DBin_node('s.serviceid').
- ' AND s.serviceid='.$_REQUEST['serviceid']
- ))))
- {
+ ' WHERE (s.triggerid is NULL OR s.triggerid NOT IN ('.$available_triggers.')) '.
+ ' AND s.serviceid='.$_REQUEST['serviceid'];
+ if(DBfetch(DBselect($sql))){
access_deny();
}
}
@@ -89,20 +84,18 @@ include_once "include/page_header.php";
$table = new CTable(null,'chart');
$table->AddRow(new CImg("chart5.php?serviceid=".$service["serviceid"].url_param('path')));
$table->Show();
- } else {
-
+ }
+ else {
$query = 'SELECT DISTINCT s.serviceid, sl.servicedownid, sl_p.serviceupid as serviceupid, s.triggerid, '.
' s.name as caption, s.algorithm, t.description, t.expression, s.sortorder, sl.linkid, s.showsla, s.goodsla, s.status '.
' FROM services s '.
' LEFT JOIN triggers t ON s.triggerid = t.triggerid '.
' LEFT JOIN services_links sl ON s.serviceid = sl.serviceupid and NOT(sl.soft=0) '.
' LEFT JOIN services_links sl_p ON s.serviceid = sl_p.servicedownid and sl_p.soft=0 '.
- ' LEFT JOIN functions f ON t.triggerid=f.triggerid '.
- ' LEFT JOIN items i ON f.itemid=i.itemid '.
' WHERE '.DBin_node('s.serviceid').
- ' AND (i.hostid is null or i.hostid not in ('.$denyed_hosts.')) '.
+ ' AND (t.triggerid IS NULL OR t.triggerid IN ('.$available_triggers.')) '.
' ORDER BY s.sortorder, sl_p.serviceupid, s.serviceid';
-
+
$result=DBSelect($query);
$services = array();
@@ -137,20 +130,26 @@ include_once "include/page_header.php";
}
if($row["status"]==0 || (isset($service) && (bccomp($service["serviceid"] , $row["serviceid"]) == 0))){
- $row['reason']="-";
+ $row['reason']='-';
}
else {
- $row['reason'] = new CList(null,"itservices");
- $result2=DBselect("select s.triggerid,s.serviceid from services s, triggers t ".
- " where s.status>0 and s.triggerid is not NULL and t.triggerid=s.triggerid ".
- ' and '.DBin_node('s.serviceid').
- " order by s.status desc,t.description");
+ $row['reason']='-';
+ $result2=DBselect('SELECT s.triggerid,s.serviceid '.
+ ' FROM services s, triggers t '.
+ ' WHERE s.status>0 '.
+ ' AND s.triggerid is not NULL '.
+ ' AND t.triggerid=s.triggerid '.
+ ' AND t.triggerid IN ('.$available_triggers.') '.
+ ' AND '.DBin_node('s.serviceid').
+ ' ORDER BY s.status DESC, t.description');
while($row2=DBfetch($result2)){
+ if($row['reason'] == '-')
+ $row['reason'] = new CList(null,"itservices");
if(does_service_depend_on_the_service($row["serviceid"],$row2["serviceid"])){
$row['reason']->AddItem(new CLink(
- expand_trigger_description($row2["triggerid"]),
- "events.php?triggerid=".$row2["triggerid"]));
+ expand_trigger_description($row2["triggerid"]),
+ "events.php?triggerid=".$row2["triggerid"]));
}
}
}
@@ -218,7 +217,7 @@ include_once "include/page_header.php";
unset($tab);
}
else {
- error('Can\'t format Tree. Check logick structure in service links');
+ error('Can not format Tree. Check logik structure in service links');
}
}
?>