You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Remove Specified Users from a Group


Remove a specified user from a group using this snippet, meaning they no longer have the permissions associated with the group. For example, if a Jira admin has left a project, use this snippet to remove them from the group with access rights to the project they left.


I want to ensure users only have access to the projects they are working on currently, enforcing the principle of least privilege. Use this script alongside the Deactivate Idle Users’ script to show inactive users, and use the ‘Remove Specified Users from a Group’ script to remove them from the groups they no longer need access to.

Good to Know

There are two ways that you can use this script: from the ScriptRunner Console as a single script, or as part of a more complex script facilitating other features in ScriptRunner for Jira.


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor // the group you want to remove users from final String groupName = "Group_A" // user names of the users to remove final List usersToRemove = ["user_A", "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 userToRemove = userManager.getUserByName(it) userUtil.removeUserFromGroup(group, userToRemove) }
Discovered an issue? Report it here

Suggested for you