For an Action to be listed on the side panel of its container it should return 
a non null value from the methods getIconFileName and getDisplayName
You can use this to return the icon and displayname if the user has the correct 
privileges and null if it doesn't.
You can check for privileges via ACL.hasPermission(p) on the item you are 
interested in and most access controlled items like jobs and Jenkins has 
simplified it by providing a hasPermission method on themselves.
An example: 
https://github.com/jenkinsci/gerrit-trigger-plugin/blob/master/gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction.java

But that only stops the action from displaying itself, its URL can still be 
navigated to by a user. So the layout tag has a permission parameter that you 
can provide the required permission to and if the user doesn't have the correct 
privileges it will render a permission denied page instead of whatever you put 
inside it.
An example: 
https://github.com/jenkinsci/gerrit-trigger-plugin/blob/master/gerrithudsontrigger/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction/index.jelly

And for any form submission you could start by calling checkPermission(p) which 
will throw an exception if the permission isn't met, and that will send the 
user to a permission denied page. There is an example of that in the first link 
as well.

Also have a look at 
https://wiki.jenkins-ci.org/display/JENKINS/Making+your+plugin+behave+in+secured+Jenkins

Robert Sandell
Software Tools Engineer - SW Environment and Product Configuration
Sony Mobile Communications

From: [email protected] [mailto:[email protected]] On 
Behalf Of Marc MacIntyre
Sent: den 3 maj 2013 01:47
To: [email protected]
Subject: RootAction authentication

I'm implementing a subclass of RootAction, and I can't figure out how to 
require the plugin to require authentication prior to performing any actions.

Can anyone point me at an example plugin that does this, or someplace in the 
javadocs to hook into the auth system?

--
Marc MacIntyre
--
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to