I want to get all anonymous spaces in my Confluence instance through a SQL query, however I couldn't find a decent query. I have this which returns the permissions on (all) spaces, but not the anonymous ones:
SELECT sp.permid, sp.permtype, s.spacekey, s.spacename, sp.permgroupname, um.lower_username FROM SPACEPERMISSIONS sp JOIN SPACES s ON sp.spaceid = s.spaceid LEFT JOIN user_mapping um ON sp.permusername = um.user_key
i have tried with where sp.permgroupname IS NULL, but that doesn't work.
Any help or pointers in the right direction?
This might work:
SELECT * FROM spacepermissions WHERE COALESCE(permgroupname, '') = '' and COALESCE(permusername, '') = '';
I got the information from this page: http://stackoverflow.com/questions/14172978/postgresql-select-empty-fields
If I understood you correctly, you would like to retrieve spaces which anonymous users can access correct?
This query should return all spaces which anonymous can see and access:
select distinct s.spacename from spaces s join spacepermissions sp on s.spaceid = sp.spaceid where sp.permtype = 'VIEWSPACE' or 'EDITSPACE' and permgroupname is null and permusername is null;
The anonymous permissions are stored with the permgroupname and permusername as null.
I hope this helps!
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...
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!
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