On Thursday, 20 August 2015 13:47:05 UTC+1, Anthony Green wrote:
>
> This was my solution
>
> import jenkins.model.*
> import hudson.security.*
>
> def instance = Jenkins.getInstance()
>
> def strategy = new GlobalMatrixAuthorizationStrategy()
>     strategy.add(Jenkins.ADMINISTER, "foo")
>     strategy.add(Jenkins.READ, 'baz')
>     strategy.add(Item.DISCOVER, 'baz')
>     strategy.add(Item.READ, 'baz')
>     strategy.add(Item.BUILD, 'baz')
>
> instance.setAuthorizationStrategy(strategy)
>
> instance.save()
>
>
Actually although this worked in the script console it doesn't work in 
init.groovy.d 

you get the error

Failed to run script 
file:/var/jenkins_home/init.groovy.d/ConfigureSecurity.groovy
groovy.lang.MissingPropertyException: No such property: Item for class: 
ConfigureSecurity
        at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
        at 
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
        at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)

restarting jenkins and the settings are applied.

Any pointers as to what's going wrong? 

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c5051ada-198b-4f44-8adb-479ce6328b3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to