You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I have a scenario where we have a JIRA instance (6.4.7). I have to do some user management clean up and I'm wanting to be able to run a script (ideally using Scriptrunner) to allow me to remove multiple users from a specified group..
Any help would be appreciated
You should be able to do something like this:
def groupManager = ComponentAccessor.groupManager
def userUtil = ComponentAccessor.userUtil
def userManager = ComponentAccessor.userManager
def usersToRemove = ["exampleUser1","exampleUser2","exampleUser3","exampleUser4","exampleUser5"] //User Names
def groupToAlter = groupManager.getGroup("NameOfGroup")
def currentUser = userManager.getUserByName(it)
Take this script, fill in the user names, fill in the name of the group, and then run it in the Script Console!
Is this close to what you were looking for? :D
Hi @Aidan Derossett [Adaptavist] tried your script in Jira 6.4.13 in script console, getting error :
No signature of method: com.atlassian.jira.user.util.UserUtilImpl.removeUserFromGroup() is applicable for argument types: (com.atlassian.crowd.embedded.impl.ImmutableGroup, com.atlassian.jira.user.DelegatingApplicationUser)
I would like knwo if i can insert the login in the "@ShortTextInput"
and he display me the groups attached to this user and i can the delete this user for all groups he attached
Login : test12
test12 attchdes groups : group1-user ; group2-dveelopers
Delete the users test 12 so that it us not part of the groups that are displayed
i have started the script but i'm blocked
Thanks in advance