com.atlassian.confluence.core
Interface ContentPermissionManager

All Known Implementing Classes:
DefaultContentPermissionManager

public interface ContentPermissionManager


Method Summary
 void addContentPermission(ContentPermission permission, ContentEntityObject content)
          Add permissions to the content entity objecct through the manager.
 List<ContentPermissionSet> getContentPermissionSets(ContentEntityObject ceo, String type)
          Get the ContentPermissionSets that affect this ceo, both inherited and directly.
 List<ContentPermission> getInheritedContentPermissions(ContentEntityObject contentEntityObject)
          Deprecated. use #getInheritedContentPermissionSets
 List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
           
 List<ContentPermission> getInheritedContentUserPermissions(ContentEntityObject contentEntityObject)
           
 List<Page> getPermittedChildren(Page page, com.atlassian.user.User user)
           
 Set<ContentPermission> getViewContentPermissions(Page page)
          Get view permissions on this page and its ancestors.
 boolean hasContentLevelPermission(com.atlassian.user.User user, String permissionType, ContentEntityObject content)
          fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.
 boolean hasPermittedChildrenIgnoreInheritedPermissions(Page page, com.atlassian.user.User remoteUser)
          Does the given page have children visible to the given user.
 boolean isPermissionInherited(Page childPage)
          Does the child page get its permissions from any ancestor?
 void removeAllGroupPermissions(String groupName)
          Remove all content permission associtated with a given group.
 void removeAllUserPermissions(String username)
          Remove all content permission associtated with a given user.
 void removeContentPermission(ContentPermission permission)
           
 void setContentPermissions(Collection<ContentPermission> contentPermissions, ContentEntityObject content, String type)
          Set the Content Permissions on the CEO to be the list of ContentPermissions passed.
 

Method Detail

addContentPermission

void addContentPermission(ContentPermission permission,
                          ContentEntityObject content)
Add permissions to the content entity objecct through the manager. This will ensure that already existing permissions are updated and that the content will be reindexed.

Parameters:
permission -
content -

setContentPermissions

void setContentPermissions(Collection<ContentPermission> contentPermissions,
                           ContentEntityObject content,
                           String type)
Set the Content Permissions on the CEO to be the list of ContentPermissions passed. Passing an empty list removes all permissions. Passing a list containing just the existing permissions does nothing.

Parameters:
contentPermissions - set of ContentPermissions
content -
type -

removeContentPermission

void removeContentPermission(ContentPermission permission)

removeAllGroupPermissions

void removeAllGroupPermissions(String groupName)
Remove all content permission associtated with a given group.

Parameters:
groupName -

removeAllUserPermissions

void removeAllUserPermissions(String username)
Remove all content permission associtated with a given user.

Parameters:
username -

getInheritedContentPermissions

@Deprecated
List<ContentPermission> getInheritedContentPermissions(ContentEntityObject contentEntityObject)
Deprecated. use #getInheritedContentPermissionSets

Returns all inherited content permission objects attached to the ancestors of this entity object, that is, all view permissions but *not* edit permissions.


getInheritedContentUserPermissions

List<ContentPermission> getInheritedContentUserPermissions(ContentEntityObject contentEntityObject)

getInheritedContentPermissionSets

List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
Returns:
a list of ContentPermissionSets of type ContentPermission.VIEW_PERMISSION of all ancestors of contentEntityObject

hasContentLevelPermission

boolean hasContentLevelPermission(com.atlassian.user.User user,
                                  String permissionType,
                                  ContentEntityObject content)
fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.

Parameters:
permissionType - ContentPermission.VIEW_PERMISSION or ContentPermission.EDIT_PERMISSION
Returns:
true if the user has the specified type of permission on the given content

getPermittedChildren

List<Page> getPermittedChildren(Page page,
                                com.atlassian.user.User user)

hasPermittedChildrenIgnoreInheritedPermissions

boolean hasPermittedChildrenIgnoreInheritedPermissions(Page page,
                                                       com.atlassian.user.User remoteUser)
Does the given page have children visible to the given user. This method assumes that the given page is already visible to the given user and does not check the inherited permissions.


getViewContentPermissions

Set<ContentPermission> getViewContentPermissions(Page page)
Get view permissions on this page and its ancestors.

Parameters:
page -
Returns:
a list of ContentPermission instances

getContentPermissionSets

List<ContentPermissionSet> getContentPermissionSets(ContentEntityObject ceo,
                                                    String type)
Get the ContentPermissionSets that affect this ceo, both inherited and directly. Note that EDIT Permissions are not currently inherited, so calling this method with EDIT will return only the direct ContentPermissionSet.

Parameters:
ceo - whose permissions will be returned. Not null.
type - one of ContentPermission.VIEW_PERMISSION or ContentPermission.EDIT_PERMISSION
Returns:
a list of ContentPermissionSets. Not null, but can be empty.

isPermissionInherited

boolean isPermissionInherited(Page childPage)
Does the child page get its permissions from any ancestor?

Parameters:
childPage -
Returns:
boolean True if the child page does not have a view permission set, and an ancestor does.


Copyright © 2003-2013 Atlassian. All Rights Reserved.