Cannot Add or Edit Permissions after Installing or Upgrading to Confluence 3.5.2 or Later
症状
For each content object (page, blog post, etc.) only one user or group can have view or edit permissions. I.e. if a page if viewable by user A and the restrictions are then edited to make it also viewable by user B, Confluence fails to save the new permission. This only affects instances where all of the following are true:
- Your instance is a fresh 3.5.2 installation or was at some point in the past upgraded to Confluence 3.5.2
- You are using Oracle or Microsoft SQL Server as your database.
原因
This is caused by a known bug, CONF-22374, where the same unique constraint is interpreted differently by different databases.
回避策
Drop the following constraints on the CONTENT_PERM table:
alter table CONTENT_PERM drop constraint cp_unique_user; alter table CONTENT_PERM drop constraint cp_unique_group;
For Oracle only, you might need to remove the indexes:
DROP INDEX CP_UNIQUE_USER; DROP INDEX CP_UNIQUE_GROUP;
Add the following constraint instead:
alter table CONTENT_PERM add constraint cp_unique_user_groups unique (cps_id, cp_type, username, groupname)
If you experience that after upgrading to 4.2.x you still unable to manage page restrictions and in your atlassian_confluence.log you find error messages while trying to do so like the following, please try to apply the steps below as a workaround.
javax.servlet.error.exception: org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.security.ContentPermission#11337731]; SQL [
]; Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'.; nested exception is java.sql.SQLException: Violation of UNIQUE KEY constra
int 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'.
As a workaround, follow these steps:
- Rebuild your indices from scratch.
- Remove all restrictions from the problematic page/space.
- Re-apply all permissions.
In some cases, there seems to be a problem while upgrading when you previously faced problems with managing page restrictions, however the steps above seem to fix the issue.
ソリューション
There is currently no resolution. Please apply the workaround if you are affected. The issue will be fixed in 3.5.3, but affected users will still need to apply the workaround.