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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,950 views 12 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot