Find Users in Confluence With Access to a Space?


One of our managers has asked me to list the users not in our company who have access to a particular space in Confluence.  If I look in the group that has access to the space, there are 111 members.  I try this in the JIRA MySQL DB (we use crowd)..

mysql> SELECT lower_user_name, email_address,pname FROM cwd_user, project  WHERE email_address NOT LIKE '*' AND pname = 'somegroup';

That lists 1190 users.  I'm guessing there's some way to narrow this down, but I can't find which table...  help! 



1 answer

0 vote

Hey David!

Try to run the query below, modifying the space names, email, and group names. This runs on the Confluence DB, if you'd like to run this on JIRA it would take lots of tweaking as the tables are named differently and permissions are defined differently. I also tried this on postgres in my own instance. If we can't get it to work I'll try to test it on a MySQL DB:

SELECT sp.permid, sp.permtype, s.spacekey, s.spacename, sp.permgroupname, um.lower_username, cu.email_address
FROM spacepermissions AS sp
JOIN spaces AS ON sp.spaceid = s.spaceid
LEFT JOIN user_mapping AS um ON sp.permusername = um.user_key
LEFT JOIN cwd_user AS cu ON um.lower_username = cu.lower_user_name
WHERE s.spacename = 'SPACENAME'
AND (cu.email_address NOT LIKE '' OR sp.permgroupname = 'GROUPNAME');

Just for reference, this is basically a modified version of the query found here. Hopefully this helps!


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
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

299 views 11 10
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