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.

Thanks!

2 answers

1 accepted

4 votes
Henning Tietgens Community Champion Aug 20, 2013

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 += u.name + "\r\n"
}

result

Henning

Thanks Henning, this worked like a charm!

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

792 views 2 19
Join discussion

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