Has anyone managed to script the authorisation levels of a user with Groovy?

I have the beginnings of a script:

import jenkins.model.*
import hudson.security.*

def instance = Jenkins.getInstance()
def hudsonRealm = new HudsonPrivateSecurityRealm(false)

instance.setSecurityRealm(hudsonRealm)

hudsonRealm.createAccount("admin_username", "admin_password")
hudsonRealm.createAccount("developer_username", "developer_password")

def adminStrategy = new GlobalMatrixAuthorizationStrategy()
    adminStrategy.add(Jenkins.ADMINISTER, "admin_username")
    
instance.setAuthorizationStrategy(adminStrategy)

instance.save()


but I can't figure out how to add READ permissions for the user 'developer'

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f51b32d2-a1e2-4f26-a20a-c76cf615ca7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to