Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Improvement to this Database query to only return content id's where a group DOESN'T have access

Steve Letch
Contributor
August 24, 2021

Hi all

 

I'm running the Power Scripts for Confluence add on with a sql query and a pageid variable. 

 

It's running relatively well but can be a bit slow. Preferably I'd like to only have to run this on restricted pages an AD group doesn't already have access to.

 

If we only used groups for restricted pages it would be easier, but a lot of pages just have individual users on the restricted list.

 

So I need something to show me all page id's where the page is restricted and this AD group doesn't have access.

 

Here's the initial query I'd like to improve.

 

If I just change the bottom line to != then it's only going to show me pages where a group of some kind has access. I need it to also show me the nulls.

 

SELECT c.contentid, c.title, s.spacekey, cps.cont_perm_type, cp.groupname
FROM SPACES s
JOIN CONTENT c ON s.spaceid = c.spaceid
JOIN CONTENT_PERM_SET cps ON c.contentid = cps.content_id
JOIN CONTENT_PERM cp ON cps.id = cp.cps_id
WHERE cp.groupname = '<group_name>';

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events