Created
December 19, 2016 16:54
-
-
Save wtrocki/18851e5edd47205414f1fe5c39d45ba4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hudson.security.* | |
| // Provide username and password here | |
| def userName = ""; | |
| def password = ""; | |
| // Do not edit script after this line | |
| def instance = Jenkins.getInstance(); | |
| def strategy = instance.getAuthorizationStrategy(); | |
| jenkins.model.Jenkins.instance.securityRealm.createAccount(userName, password); | |
| strategy.add(hudson.model.Item.BUILD, userName); | |
| strategy.add(Item.CANCEL, userName); | |
| strategy.add(Item.CONFIGURE , userName); | |
| strategy.add(Item.CREATE , userName); | |
| strategy.add(Item.DELETE , userName); | |
| strategy.add(Item.DISCOVER , userName); | |
| strategy.add(Item.READ , userName); | |
| strategy.add(Item.WORKSPACE , userName); | |
| instance.save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment