Scripts not permitted to use staticMethod in Extensible Choice System Groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Scripts not permitted to use staticMethod in Extensible Choice System Groovy

Victoria Kozel
Hello,

I am writing a simple groovy script to display role-based choices in the Extensible Choice. I get 

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance

when calling 

def authStrategy = Jenkins.instance.getAuthorizationStrategy()

I am not sure I understand the reason for this, but my question is - Is there a workaround for this error?

Thank you!!
Vicki

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a7a4b4ab-a2fc-4e2b-8363-692b0f17ee67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scripts not permitted to use staticMethod in Extensible Choice System Groovy

Victor Martinez
It seems the https://wiki.jenkins-ci.org/display/JENKINS/Script+Security+Plugin has been installed and enabled, therefore you need to whitelist those methods. Or even using the https://wiki.jenkins-ci.org/display/JENKINS/Permissive+Script+Security+Plugin plugin in case you would like to grant access to all those internal methods.

Cheers

On Friday, 21 April 2017 01:09:54 UTC+1, Victoria Kozel wrote:
Hello,

I am writing a simple groovy script to display role-based choices in the Extensible Choice. I get 

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance

when calling 

def authStrategy = Jenkins.instance.getAuthorizationStrategy()

I am not sure I understand the reason for this, but my question is - Is there a workaround for this error?

Thank you!!
Vicki

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5d8b5c6f-660d-4be2-8e85-dfdc4218fa81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Scripts not permitted to use staticMethod in Extensible Choice System Groovy

Victoria Kozel
In reply to this post by Victoria Kozel
Victor,
 thank you so much for your help! I already had Script Security Plugin installed, and all the methods I tried to execute unsuccessfully were conveniently added in the Method Authorization queue! All i needed to do is just approved them. Worked like a charm. Thank you!!

On Thursday, April 20, 2017 at 5:09:54 PM UTC-7, Victoria Kozel wrote:
Hello,

I am writing a simple groovy script to display role-based choices in the Extensible Choice. I get 

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance

when calling 

def authStrategy = Jenkins.instance.getAuthorizationStrategy()

I am not sure I understand the reason for this, but my question is - Is there a workaround for this error?

Thank you!!
Vicki

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b84f6e6e-9b68-4ef9-9d34-aafda5caedc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...