Confluence : Changes to the Page Permission API in Confluence 2.4
This page last changed on Mar 01, 2007 by don.willis@atlassian.com.
Confluence 2.4 contains changes to the Confluence API that will affect any plugins that modify Page Permissions (aka ContentPermissions). Some methods have been deprecated, some new methods have been created, and one method now behaves differently from before.
Summary of Changes Deprecated methodsContentPermissionManager.getInheritedViewContentPermissions(Page) ContentEntityObject.getPermissions() Changed methodsContentPermissionManager.addContentPermission(ContentPermission permission, ContentEntityObject content) Added methodsContentPermissionManager.setContentPermissions(List contentPermissions, ContentEntityObject content, String type) ContentEntityObject.getContentPermissionSet(String type) ContentEntityObject.hasPermissions(String type) Removed methodsContentPermissionManager.saveContentPermission(ContentPermission permission) ContentEntityObject.setPermissions(List permissions) The change most likely to cause problems is: ContentPermissionManager.addContentPermission(ContentPermission permission, ContentEntityObject content) This method now adds a ContentPermission to the ContentEntityObject as one would expect. Previously if a ContentPermission already existed on the ContentEntityObject, then any existing ContentPermission would be removed. That is, the method really behaved as one would expect "setContentPermission" to behave. As a result, any code that used addContentPermission in Confluence 2.3 or earlier, should now use setContentPermissions with a single entry list. Example conversion of old addContentPermission usage replace ContentPermissionManager.addContentPermission(p, c) with ContentPermissionManager.setContentPermissions(java.util.Collections.singletonList(p), c, p.getType()) Most methods that used to return a ContentPermission have been replaced with methods that return a ContentPermissionSet. In some places we have used deprecation to point to the new method and reimplemented the old method to extract the first ContentPermission from the ContentPermissionSet. As usual, the methods on the ContentPermissionManager should be used rather than those on the ContentEntityObject. The only ContentEntityObject method that should be used is getContentPermissionSet. Even that method should be used only to display the existing Permissions. All writes to the ContentPermissionSets should be performed via the ContentPermissionManager. The onContentContextChanged method of the ContentPermissionManager was previously used to notify a ContentPermissionManager that cached permissions on a ContentEntityObject may be invalid. This is now accomplished by publishing a ContentPermissionEvent. That event is published automatically when changing ContentPermissions via the ContentPermissionManager. No changes have been made yet to the the XML RPC API. It does not currently allow modification of ContentPermissions. |
![]() |
Document generated by Confluence on May 01, 2007 19:29 |