How do I query the database to list the users in the specific group.

Mike August 2, 2021

I want to look up users in the database that belong to a certain group i.e. "space-managers"

2 answers

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2021

If you're using internal accounts, you'll need to join cwd_membership to cwd_user to find a (human) list of people in a group.  And cwd_group to see the human names of the groups.

Mike August 2, 2021

Thanks for answering! Would you be able to write out the SQL? We are using a MySQL instance. 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2021

select * from cwd_membership join cwd_user on cwd_membership.child_user_id = cwd_user.id;

Is the raw starting point in postgres (should translate to MySQL without any fuss).  You probably want to add a second join on cwd_group if you want the group names too.

Like Jon Chatwin likes this
Philippe PEREZ November 9, 2022

For faster reference, the MySQL code is: 

SELECT u.*
FROM cwd_user u
JOIN cwd_membership m ON m.child_user_id = u.id
JOIN cwd_group g ON m.parent_id = g.id
WHERE g.group_name = 'GROUP_NAME_TO_CONSIDER'
0 votes
Patrick Vanhoof
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2021

Why do you want to query the database when the information is available in Confluence, see https://community.atlassian.com/t5/Confluence-questions/How-do-I-view-a-list-of-confluence-administrators/qaq-p/1767470?

Philippe PEREZ November 9, 2022

Because you may want to list the users of confluence-users and have 15.000 of them ;-).

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events