Skip to content

Commit

Permalink
Give users admin permission if it's missing
Browse files Browse the repository at this point in the history
  • Loading branch information
solita-timo-mihaljov committed Jun 29, 2016
1 parent c5f4592 commit 5b0b304
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions library/solita_jenkins_user
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,21 @@ if (params.state == 'present') {
if (!(params.name in currentUsers)) {
user = securityRealm.createAccount(params.name, params.password)
user.save()
result.changed = true
}
if (!(authorizationStrategy.hasPermission(params.name, Jenkins.ADMINISTER))) {
authorizationStrategy.add(Jenkins.ADMINISTER, params.name)
jenkins.save()
result.changed = true
}
} else {
if (params.name in currentUsers) {
user = securityRealm.getUser(params.name)
user.delete()
result.changed = true
}
}
jenkins.save()
println JsonOutput.toJson(result)
"""
Expand Down

0 comments on commit 5b0b304

Please sign in to comment.