Get user\'s permissions in hudson


/ Published in: Groovy
Save to your folder(s)

Getting user's permissions in Hudson


Copy this code and paste it in your HTML
  1. USR = 'johnson' // this may be scriptler parameter
  2.  
  3. hudson.model.Hudson.instance.items.each {jb ->
  4. sec = jb.getProperty(hudson.security.AuthorizationMatrixProperty.class)
  5. if (USR in sec?.groups) {
  6. prm = sec?.grantedPermissions.findAll{USR in it.value}.keySet().name
  7. println "$jb.name: ${prm.sort().join ','}"
  8. }
  9. }
  10. "FINISHED" // for don't print too large result in console

URL: hudson_user_perms

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.