Skip to content

Instantly share code, notes, and snippets.

@whittlec
Created July 30, 2013 13:13
Show Gist options
  • Save whittlec/6112778 to your computer and use it in GitHub Desktop.
Save whittlec/6112778 to your computer and use it in GitHub Desktop.
Apply permissions to users in Jenkins using matrix authorization strategy
strategy = Hudson.instance.authorizationStrategy;
if (strategy instanceof hudson.security.GlobalMatrixAuthorizationStrategy) {
for (user in ["bob", "mike"]) {
for (perm in ["hudson.model.Hudson.Read",
"hudson.model.Item.Read",
"hudson.model.Item.Build",
"hudson.model.Item.Workspace",
"hudson.model.Run.Delete",
"hudson.model.Run.Update",
"hudson.model.View.Configure",
"hudson.model.View.Create",
"hudson.model.View.Delete",
"hudson.scm.SCM.Tag"]) {
strategy.add(hudson.security.Permission.fromId(perm), user);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment