How can I find all JIRA users without any group assignments?

Can anybody think of a way to find all JIRA users that do not belong to any group?

MySQL query would be fine - I just need userIDs. Somebody who worked here before thought that removing all group permissions was sufficient to keep a user "active", but we're finding that unless a user has Assignable and Create Issue (?) permissions, Bulk Changes are getting hung up on these "zombie" users.

My plan, once I get the list, is to use the JIRA CLI to assign these users to an "Ex-employees" group that only has the above permissions.


2 answers

1 accepted

5 votes
Accepted answer

You can use the Script Runner plugin and the following script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil

UserUtil userUtil = ComponentAccessor.getUserUtil()

result = ''

userUtil.getUsers().findAll{userUtil.getGroupsForUser(it.getName()).size() == 0}.each{ u ->
    result += + "<br>"




Thanks Henning, this worked like a charm!

I use the suggested Scriptrunner script and get this error:

startup failed: Script20.groovy: 8: expecting '}', found '-' @ line 8, column 90. tName()).size() == 0}.each{ u -&gt; ^ 1 error

I'm not sure why I'm getting an error about the curly bracket "}" at that point. I copied and pasted this script directly into the Scriptrunner script console and ran it.

Hi, it's a HTML conversion error from Atlassian Answers to Atlassian Community. I corrected the script, please try to copy it again.


Happy Days are Here Again. Thanks a lot!!

I believe this is close to what you are looking for.

SELECT U.ID, U.user_name, G.group_name
FROM cwd_user U
LEFT JOIN cwd_membership M ON U.ID = M.child_id
LEFT JOIN cwd_group G ON G.ID = M.parent_id
WHERE M.child_id IS NULL

Thanks for the answer Norman, but it was easier for me to just run it from Script Runner.

Thanks man, exactly what i was looking for.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,885 views 19 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you