How to check permissions for a specific page via SQL queries
Purpose
It may be helpful to check the permissions of a specific page to verify what is being reported in the UI or an administrator may want to generate this information from the database for reporting purposes
Solution
The below query will give an output of all permissions on a given page. Just replace <page title here>
with your exact page title
For Postgres
SELECT u.username , c.cp_type , c.creationdate , c.lastmoddate
FROM content_perm AS c
JOIN user_mapping AS u
ON c.username = u.user_key
WHERE c.cps_id in (SELECT id FROM content_perm_set WHERE content_id in (SELECT contentid FROM content WHERE title= '<page title here>' ORDER BY version DESC LIMIT 1));
For MySQL
SELECT u.username , c.cp_type , c.creationdate , c.lastmoddate
FROM CONTENT_PERM AS c
JOIN user_mapping AS u
ON c.username = u.user_key
WHERE c.cps_id in (SELECT id FROM CONTENT_PERM_SET WHERE content_id in (SELECT contentid FROM CONTENT WHERE title= '<page title here>'));
Last modified on Oct 28, 2019
Powered by Confluence and Scroll Viewport.