Problem: When adding items to all hosts it really adds the item to all hosts, not only to those the user has permission for.
I searched the forum and the web for a solution of that problem and I wonder if it is a bug or a feature. I considered it a bug and resolved it for version 1.0 of Zabbix with the following patch:
The patch allows an user to add items to only those hosts he has U permission for. If the user has a default permission of U for id=0 it adds the item to all hosts.
Maybe it's useful for some of you.
Regards,
Frank.
I searched the forum and the web for a solution of that problem and I wonder if it is a bug or a feature. I considered it a bug and resolved it for version 1.0 of Zabbix with the following patch:
Code:
--- frontends/php/items.php.orig Thu Jun 30 12:43:01 2005
+++ frontends/php/items.php Thu Jun 30 11:13:34 2005
@@ -60,9 +60,27 @@
}
if($HTTP_GET_VARS["register"]=="add to all hosts")
{
- $result=DBselect("select hostid,host from hosts order by
host");
+
+ /*
+ ** If we have Default permission 'U' for id '0' add item
to all hosts
+ */
+
+ if(DBselect("select * from rights where name='Default pe
rmission' and id='0' and permission='U' and userid=".$USER_DETAILS[userid]))
+ {
+ $result=DBselect("select hostid,host fro
m hosts order by host");
+ }
+
+ /*
+ ** Else add item only to hosts that we have 'U'
permission for
+ */
+
+ else
+ {
+ $result=DBselect("select hosts.hostid,ho
sts.host from hosts,rights where rights.id=hosts.hostid and rights.userid=".$USE
R_DETAILS[userid]." and rights.permission='U'");
+ }
$hosts_ok="";
$hosts_notok="";
+ echo $result;
while($row=DBfetch($result))
{
$result2=add_item($HTTP_GET_VARS["description"],
$HTTP_GET_VARS["key"],$row["hostid"],$HTTP_GET_VARS["delay"],$HTTP_GET_VARS["his
tory"],$HTTP_GET_VARS["status"],$HTTP_GET_VARS["type"],$HTTP_GET_VARS["snmp_comm
unity"],$HTTP_GET_VARS["snmp_oid"],$HTTP_GET_VARS["value_type"],$HTTP_GET_VARS["
trapper_hosts"],$HTTP_GET_VARS["snmp_port"],$HTTP_GET_VARS["units"],$HTTP_GET_VA
RS["multiplier"],$HTTP_GET_VARS["delta"]);
Maybe it's useful for some of you.
Regards,
Frank.