Cannot Edit Restrictions on Confluence Tools > Restrictions, Stack Trace 'execute User with name '[User]' not found, but page permissions still exist on: page: [PageName]' due to nonexistent user
Problem
When trying to modify an existing Restriction, under Tools > Restrictions, the following error is thrown:
2013-08-06 11:44:12,876 WARN [http-8090-2] [confluence.pages.actions.GetPagePermissionsAction] execute User with name 'RemovedUser' not found, but page permissions still exist on: page: Test Page (106702962)
-- space: 44269570 | url: /pages/getpagepermissions.action | page: 106702962 | userName: admin | referer: http://192.168.10.101:8090/pages/viewpage.action?pageId=106702962 | action: getpagepermissions
Cause
There is a user entry in CONTENT PERM table that does not exist on the confluence user base. That will cause the above stack trace to appear.
Diagnosis:
To find those users that belong to restrictions that are no longer in Confluence Users run below one of the below queries:
-- From Confluence 5.2.3 to latest
SELECT * FROM CONTENT_PERM cp inner join CONTENT_PERM_SET cps on cp.CPS_ID=cps.ID
WHERE USERNAME NOT IN (SELECT user_key FROM user_mapping);
-- Prior Confluence 5.2.3
SELECT * FROM CONTENT_PERM cp inner join CONTENT_PERM_SET cps on cp.CPS_ID=cps.ID
WHERE USERNAME NOT IN (SELECT user_name FROM cwd_user);
Resolution
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
- Shutdown Confluence
Go to your Database and Run the following queries:
-- From Confluence 5.2.3 to latest delete from CONTENT_PERM where USERNAME NOT IN (SELECT user_key FROM user_mapping); delete from CONTENT_PERM_SET where ID NOT IN (select CPS_ID from CONTENT_PERM); -- Prior Confluence 5.2.3 delete from CONTENT_PERM where USERNAME NOT IN (SELECT user_name FROM cwd_user); delete from CONTENT_PERM_SET where ID NOT IN (select CPS_ID from CONTENT_PERM);
- Restart Confluence
Check if the error messages are gone.