How do I find a set of users that are not part of one group

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.

Purpose

You want to look up users in the database that do not belong to a certain group, but this cannot be done through the UI. For example, if you want to disable any users that do not belong to confluence-users and should not have access you can run the query below. To run this, just replace the <group_name> with the name of the group you want to exclude.

Solution

  1. Connect to your database and run the following query:
SELECT *
FROM cwd_user
WHERE id NOT IN (SELECT m.child_user_id FROM cwd_membership AS m
JOIN cwd_group AS g ON m.parent_id = g.id
WHERE g.group_name = '<group_name>' AND m.child_user_id IS NOT NULL);

Last modified on Jan 30, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.