Page 1 of 1

Actions code section

Posted: Sat Oct 24, 2015 4:15 am
by WillemDH
Just an informative question. Now there is a permissions column in the actions component, what is the use of the code comlumn exactly. Before I used it to replace

Code: Select all

/*if((%objecttype%=='host' && '%hoststateid%'!='0') || (%objecttype%=='service' && '%servicestateid%'!='0')){$img='/nagiosxi/images/schedulecheck.png';$showlink=true;} else{$showlink=false;}*/
by

Code: Select all

if(is_admin()){$showlink=true;} else{$showlink=false;}
If I only wanted admins to see the actions. What does this first code block exactly do? Can we empty all the code blocks and will the permissions setting work independently?

Re: Actions code section

Posted: Mon Oct 26, 2015 12:24 pm
by tmcdonald
I would imagine the permissions dropdown was added specifically for this reason, so the code box can be used to do other things. I'll test this out to make sure it is working, but to answer your question directly:
WillemDH wrote:what is the use of the code comlumn exactly
Probably not much use anymore. In my opinion, running any sort of user-supplied PHP code is A Bad Thing, but I think we originally put it in there so custom actions can be defined (and permissions-based code can be run).

Re: Actions code section

Posted: Wed Jan 20, 2016 4:54 am
by WillemDH
Hey Trevor,
Probably not much use anymore.
As the actions overview is getting very crowded over here and as you say
running any sort of user-supplied PHP code is A Bad Thing
I think it would make the actions component easier to read if this unused code column, which takes 1/4th of the screen could be hidable or left out?

Grtz

Re: Actions code section

Posted: Wed Jan 20, 2016 12:23 pm
by bwallace
Good suggestion, we've filed a feature request for that = task id:7529. Shall we lock this thread or were there additional questions?

Re: Actions code section

Posted: Wed Jan 20, 2016 12:27 pm
by WillemDH
Please lock. Thanks!