Skip to content

Instantly share code, notes, and snippets.

@alces
Created November 17, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alces/4de2a25a9ff4399a65dc to your computer and use it in GitHub Desktop.
Save alces/4de2a25a9ff4399a65dc to your computer and use it in GitHub Desktop.
Extract list of global permissions a particular user has from Jenkins' config.xml
USERNAME = 'dummy'
import hudson.model.Hudson
println new XmlSlurper().parse(
new File(Hudson.instance.root, 'config.xml')
).authorizationStrategy.permission.collect {
it.text().split(':')
}.findAll {
it[1] == USERNAME
}.collect {
it[0].replaceAll(/^[a-z.]+/, '')
}.join(', ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment