Query to Check Groups Actively Used in Space Permissions and Page Restrictions

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

LDAP/AD connections can often bring in more groups than intended and it is difficult to scope what groups are currently being used in Confluence. The following query can be used to determine the group and space for all groups used in Confluence.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 WITH combined AS ( SELECT DISTINCT GROUPNAME AS name, SPACENAME, 'page' as label FROM CONTENT_PERM INNER JOIN CONTENT_PERM_SET on CONTENT_PERM.CPS_ID = CONTENT_PERM_SET.ID INNER JOIN CONTENT on CONTENT_PERM_SET.CONTENT_ID = CONTENT.CONTENTID INNER JOIN SPACES on CONTENT.SPACEID = SPACES.SPACEID WHERE GROUPNAME IS NOT NULL AND GROUPNAME NOT IN ('confluence-users','confluence-administrators') UNION SELECT DISTINCT PERMGROUPNAME as name, SPACENAME, 'space' as label FROM SPACEPERMISSIONS INNER JOIN SPACES on SPACEPERMISSIONS.SPACEID = SPACES.SPACEID WHERE PERMGROUPNAME IS NOT NULL AND PERMGROUPNAME NOT IN ('confluence-users','confluence-administrators') ) SELECT DISTINCT name, SPACENAME, label FROM combined WHERE name IS NOT NULL;

ℹ️ The "label" column will list 'space' or 'page' to denote if the entry applies to a space permission or page restriction.

ℹ️ This query has been tested against SQL Server and PostgreSQL. Other databases may require altered syntax.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.