Created
May 2, 2021 05:57
-
-
Save vikrantyadav11/656383041bb95e5aad2158cb31694792 to your computer and use it in GitHub Desktop.
Add users to a jira group
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 com.atlassian.jira.component.ComponentAccessor | |
| // the group you want to remove users from | |
| final String groupName = "jira-users" | |
| // user names of the users to remove | |
| final List<String> usersToRemove = ["john.doe","user_B"] | |
| def userUtil = ComponentAccessor.userUtil | |
| def userManager = ComponentAccessor.userManager | |
| def group = ComponentAccessor.groupManager.getGroup(groupName) | |
| assert group : "Could not find group with name $groupName" | |
| usersToRemove.each { | |
| def userToAdd = userManager.getUserByName(it) | |
| userUtil.addUserToGroup(group, userToAdd) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment