Page 2 of 2
Re: Custom Quick Actions
Posted: Thu Mar 06, 2014 4:43 pm
by lmiltchev
I will be testing this as soon as developers finish the task. I am not sure when they are going to get to it, since this is not a priority at the moment. In any case, we will post the results.
Re: Custom Quick Actions
Posted: Thu Mar 06, 2014 4:56 pm
by BanditBBS
I just tested and this worked:
Code: Select all
786 if(is_admin() == true) {
787 // additional actions...
788 $cbdata=array(
789 "hostname" => $hostname,
790 "servicename" => $servicename,
791 "service_id" => $service_id,
792 "servicestatus_xml" => $xml,
793 "actions" => array(),
794 );
795 do_callbacks(CALLBACK_SERVICE_DETAIL_ACTION_LINK,$cbdata);
796 $customactions=grab_array_var($cbdata,"actions",array());
797 foreach($customactions as $ca){
798 $output.=$ca;
799 }
800 //$output.=serialize($customactions);
801
802 }
803 }
this hides all custom actions on services from non admins. Verified and tested

Do the same to the hosts file and it'll work there.
Re: Custom Quick Actions
Posted: Thu Mar 06, 2014 5:09 pm
by sreinhardt
Sweet, thanks for the test!
Re: Custom Quick Actions
Posted: Sat Sep 05, 2015 1:55 pm
by WillemDH
Hello,
Just wanted to inquire to the state of this feature request to enable us to set view permissions per task. We have some actions that need to be visible by normal users, and other that may only be seen by admins.
Tx
Re: Custom Quick Actions
Posted: Tue Sep 08, 2015 9:52 am
by ssax
He did leave this comment on the feature request, will that not work for you?
I'm going to see about getting this added but just so you guys are aware, you can add the following into the Code box, it will only show for Admins
Code: Select all
if(is_admin()){$showlink=true;} else{$showlink=false;}
Re: Custom Quick Actions
Posted: Tue Sep 08, 2015 10:08 am
by WillemDH
Sean,
Sorry I thought I read in the thread:
this hides all custom actions on services from non admins
So I was thinking this only works for all actions or none. I will try your suggestion.
EDIT: I tried:
Code: Select all
/*if((%objecttype%=='host' && '%hoststateid%'!='0') || (%objecttype%=='service' && '%servicestateid%'!='0')){$img='/nagiosxi/images/schedulecheck.png';$showlink=true;} else{$showlink=false;}if(is_admin()){$showlink=true;} else{$showlink=false;}*/
Code: Select all
/*if((%objecttype%=='host' && '%hoststateid%'!='0') || (%objecttype%=='service' && '%servicestateid%'!='0')){$img='/nagiosxi/images/schedulecheck.png';$showlink=true;} else{$showlink=false;};if(is_admin()){$showlink=true;} else{$showlink=false;}*/
Code: Select all
/*if(is_admin()){$showlink=true;} else{$showlink=false;}*/
But the link to the Reactor chain keeps showing for my test normal user. Am I missing something?
EDIT: Never mind, it was actually just
Code: Select all
if(is_admin()){$showlink=true;} else{$showlink=false;}
My PHP knowledge is very low. Sorry for that. You can close this thread. This solution is perfect for now.
Grtz