First, thank you for this new and most welcomed feature. I seem to have a permissions problem with the "API Access" user group. For some reason I can't add read/write rights to new host groups to the API group. I don't receive an error, and in fact, once I add them they are moved to the read/write column. If I save the group changes and go back in, those groups I just added are moved back to the deny column. Has anyone else seen this? I've tried with 1.8 release and trunk. I should also note the api users is a super admin.
Ad Widget
Collapse
API issues....
Collapse
X
-
Well, I fixed one of my issues with a "hack". I simply disabled the permissions check in the events api class. Under the public function call "acknowledge" I did the following:
Changed:
To:Code:if(!empty($events)){ $allowed_events = self::get(array('eventids' => $eventids, 'preservekeys' => 1)); foreach($events as $num => $event){ if(!isset($allowed_events[$event['eventid']])){ self::setError(__METHOD__, ZBX_API_ERROR_PERMISSIONS, 'You have not enough rights for operation'); return false; } } } if(!empty($triggers)){ $allowed_triggers = CTrigger::get(array('triggerids' => $triggerids, 'preservekeys' => 1)); foreach($triggers as $num => $trigger){ if(!isset($allowed_triggers[$trigger['triggerid']])){ self::setError(__METHOD__, ZBX_API_ERROR_PERMISSIONS, 'You have not enough rights for operation'); return false; } } $events = array_merge($events, self::get(array('triggerids' => $triggerids, 'nopermissions' => 1, 'preservekeys' => 1))); $eventids = zbx_objectValues($events, 'eventid'); }
Now I can finish my mobile site that has "guest" trigger acknowledgements so people can ack triggers which prohibits other escalations from occuring. I'm using the PHP api created by Farley (thanks Farley!!!!) found here. I'll post my complete site to the wiki for those that want it when I'm done. The site I'm creating works on iPhone's and Android phones (haven't tested Windows Mobile or BBerry's as our company moved to Androids for the support staff but should work as its really just the formatting of the site thats specific to the iphone and android).Code:if(!empty($events)){ $allowed_events = self::get(array('eventids' => $eventids, 'preservekeys' => 1)); //foreach($events as $num => $event){ // if(!isset($allowed_events[$event['eventid']])){ // self::setError(__METHOD__, ZBX_API_ERROR_PERMISSIONS, 'You have not enough rights for operation'); // return false; // } //} } if(!empty($triggers)){ $allowed_triggers = CTrigger::get(array('triggerids' => $triggerids, 'preservekeys' => 1)); //foreach($triggers as $num => $trigger){ // if(!isset($allowed_triggers[$trigger['triggerid']])){ // self::setError(__METHOD__, ZBX_API_ERROR_PERMISSIONS, 'You have not enough rights for operation'); // return false; // } //} $events = array_merge($events, self::get(array('triggerids' => $triggerids, 'nopermissions' => 1, 'preservekeys' => 1))); $eventids = zbx_objectValues($events, 'eventid'); }
Comment