Change By: Patrick McKeown (08/Apr/13 5:14 AM)
Description: Initially suggested by jglick when I asked  about this  a question  on the developer group  https://groups.google.com/forum/?fromgroups=#!topic/jenkinsci-dev/H8gAZcDOqgc -

The cleaner way to do this would probably be to create a delegating ExecutorService implementation whose submit and related methods capture the current SecurityContext 
and then wrap the task in a block like the above. Then you could simply write: 

SomeUtilityClass.wrapExecutorWithSecurity(service).submit(new Callable<Void>() { 
     public Void call() throws Exception { 
         Jenkins.getInstance().getItem(whatever); // should work 
         return null; 
     } 
}); 

Such a wrapper would be a welcome addition to Jenkins core, I think. Use the jenkins.security package if you want to play with a pull request, or it could be added to 
hudson.security.ACL which already hosts the impersonate methods. 
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to