[ZBX-4273] getting permission error while creating an action Created: 2011 Oct 25  Updated: 2017 May 30  Resolved: 2011 Dec 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 1.8.8
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Sergey Alexandrov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api, trivial
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

SLES 11 SP1



 Description   

While trying to create an action on a trigger getting

Response: {"jsonrpc"=>"2.0", "error"=>

{"code"=>-32500, "message"=>"Application error.", "data"=>"[ CAction::create ] No permissions !"}

, "id"=>66484}

error, unless the user is super admin.

This happens because of an error in check_permission_for_action_conditions function in the frontends/php/include/actions.inc.php file. The check says "switch($ac_data['type'])" there, but the right name for this param according to api description and the rest of the source is "conditiontype".

The workaroud is to set both "type" and "conditiontype" vars to contain the same value.



 Comments   
Comment by Alexander Sorokin (Inactive) [ 2011 Dec 02 ]

Can not create action at all. In Zabbix manual i see example - 80 lines without any comments.
Can You show a working example?

Comment by Alexander Sorokin (Inactive) [ 2011 Dec 02 ]

Working example (change values and remove comments):
[
{
"name": "ZABBIX ACTIO12",
"eventsource": "0",
"evaltype": "0",
"status": "1",
"esc_period": "3600",
"def_shortdata": "

{TRIGGER.NAME}: {STATUS}",
"def_longdata": "{TRIGGER.NAME}

:

{STATUS}",
"recovery_msg": "0",
"r_shortdata": "{TRIGGER.NAME}: {STATUS}

",
"r_longdata": "

{TRIGGER.NAME}: {STATUS}",
"conditions": [
{ "conditiontype": "3", "operator": "2", "value": "TEST" },
{ "conditiontype": "1", "operator": "1", //HOST ID "value": "10048" }
],
"operations": [
{
"operationtype": "0",
"object": "0",
//USER ID
"objectid": "4",
"shortdata": "{TRIGGER.NAME}

:

{STATUS}",
"longdata": "{TRIGGER.NAME}: {STATUS}

",
"esc_period": "0",
"esc_step_from": "1",
"esc_step_to": "1",
"default_msg": "1",
"evaltype": "0",
"opconditions": [],
"opmediatypes": []
}
]
}
]

Comment by Alexander Sorokin (Inactive) [ 2011 Dec 02 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-4273

Comment by Alexander Sorokin (Inactive) [ 2011 Dec 07 ]

Fixed in 1.8.10rc1

Comment by richlv [ 2011 Dec 10 ]

(1) changelog entry has not been added to the trunk changelog

<sanja> RESOLVED

Generated at Fri Apr 26 01:39:38 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.