com.atlassian.confluence.core
Class DefaultContentPermissionManager

java.lang.Object
  extended bycom.atlassian.confluence.core.DefaultContentPermissionManager
All Implemented Interfaces:
ContentPermissionManager

public class DefaultContentPermissionManager
extends Object
implements ContentPermissionManager


Field Summary
protected  ContentPermissionDao contentPermissionDao
           
protected  PageManager pageManager
           
 
Constructor Summary
DefaultContentPermissionManager()
           
 
Method Summary
 void addContentPermission(ContentPermission permission, ContentEntityObject content)
          Adds a new current content permission to the CEO if it doesn't have it already.
protected  boolean cannotHaveInheritedPermissions(ContentEntityObject contentEntityObject)
          Check (for speed) whether we should even bother to query for possible inherited permissions.
 List getContentPermissionSets(ContentEntityObject ceo, String type)
          Get the ContentPermissionSets that affect this ceo, both inherited and directly.
 List getInheritedContentPermissions(ContentEntityObject contentEntityObject)
          Returns all inherited content permission objects attached to the ancestors of this entity object, that is, all view permissions but *not* edit permissions.
 List getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
           
 List getInheritedContentUserPermissions(ContentEntityObject contentEntityObject)
          Filters the inherited content permission sets of a page for a list of inherited user permissions (of type ContentPermission.VIEW_PERMISSION)
 List getInheritedViewContentPermissions(Page page)
          only get inherited permissions that are restrict the viewing of pages
 List getPermittedChildren(Page page, User user)
           
 Set getViewContentPermissions(Page page)
          Get view permissions on this page and its ancestors.
 boolean hasContentLevelPermission(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.
 void removeContentPermission(ContentPermission contentPermission)
           
 void setContentPermissionDao(ContentPermissionDao contentPermissionDao)
           
 void setContentPermissions(Collection requiredPermissions, ContentEntityObject content, String type)
          Set the Content Permissions on the CEO to be the list of ContentPermissions passed.
 void setContentPermissionSetDao(ContentPermissionSetDao contentPermissionSetDao)
           
 void setEventManager(EventManager eventManager)
           
 void setIndexer(ConfluenceIndexer indexer)
           
 void setInheritedContentPermissionManager(InheritedContentPermissionManager inheritedContentPermissionManager)
           
 void setPageManager(PageManager pageManager)
           
 void setUserAccessor(UserAccessor userAccessor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pageManager

protected PageManager pageManager

contentPermissionDao

protected ContentPermissionDao contentPermissionDao
Constructor Detail

DefaultContentPermissionManager

public DefaultContentPermissionManager()
Method Detail

getInheritedContentPermissions

public List getInheritedContentPermissions(ContentEntityObject contentEntityObject)
Description copied from interface: ContentPermissionManager
Returns all inherited content permission objects attached to the ancestors of this entity object, that is, all view permissions but *not* edit permissions.

Specified by:
getInheritedContentPermissions in interface ContentPermissionManager

cannotHaveInheritedPermissions

protected boolean cannotHaveInheritedPermissions(ContentEntityObject contentEntityObject)
Check (for speed) whether we should even bother to query for possible inherited permissions.

At the moment this simply checks if the CEO is hierarchical AND has a parent - could be optimised further in the future.

Returns:
TRUE if this object cannot have inherited permissions, FALSE is the object could have inherited permissions

getInheritedContentUserPermissions

public List getInheritedContentUserPermissions(ContentEntityObject contentEntityObject)
Filters the inherited content permission sets of a page for a list of inherited user permissions (of type ContentPermission.VIEW_PERMISSION)

Specified by:
getInheritedContentUserPermissions in interface ContentPermissionManager

getInheritedContentPermissionSets

public List getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
Specified by:
getInheritedContentPermissionSets in interface ContentPermissionManager
Returns:
a list of ContentPermissionSets of type ContentPermission.VIEW_PERMISSION of all ancestors of contentEntityObject

getContentPermissionSets

public List getContentPermissionSets(ContentEntityObject ceo,
                                     String type)
Description copied from interface: ContentPermissionManager
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.

Specified by:
getContentPermissionSets in interface ContentPermissionManager
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.

hasContentLevelPermission

public boolean hasContentLevelPermission(User user,
                                         String permissionType,
                                         ContentEntityObject content)
Description copied from interface: ContentPermissionManager
fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.

Specified by:
hasContentLevelPermission in interface ContentPermissionManager
Parameters:
permissionType - ContentPermission.VIEW_PERMISSION or ContentPermission.EDIT_PERMISSION
Returns:
true if the user has the specified type of permission on the given content

removeContentPermission

public void removeContentPermission(ContentPermission contentPermission)
Specified by:
removeContentPermission in interface ContentPermissionManager

addContentPermission

public void addContentPermission(ContentPermission permission,
                                 ContentEntityObject content)
Adds a new current content permission to the CEO if it doesn't have it already.

Specified by:
addContentPermission in interface ContentPermissionManager
Parameters:
permission -
content -
Throws:
IllegalArgumentException - if the permission's user or group is invalid.

setContentPermissions

public void setContentPermissions(Collection requiredPermissions,
                                  ContentEntityObject content,
                                  String type)
Description copied from interface: ContentPermissionManager
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.

Specified by:
setContentPermissions in interface ContentPermissionManager
Parameters:
requiredPermissions - set of ContentPermissions
content -
type -

getPermittedChildren

public List getPermittedChildren(Page page,
                                 User user)
Specified by:
getPermittedChildren in interface ContentPermissionManager

getInheritedViewContentPermissions

public List getInheritedViewContentPermissions(Page page)
Deprecated. use ContentPermissionManager.getInheritedContentPermissionSets(ContentEntityObject)

Description copied from interface: ContentPermissionManager
only get inherited permissions that are restrict the viewing of pages

Specified by:
getInheritedViewContentPermissions in interface ContentPermissionManager
Parameters:
page -
Returns:
a list of ContentPermission instances

getViewContentPermissions

public Set getViewContentPermissions(Page page)
Description copied from interface: ContentPermissionManager
Get view permissions on this page and its ancestors.

Specified by:
getViewContentPermissions in interface ContentPermissionManager
Parameters:
page -
Returns:
a list of ContentPermission instances

setContentPermissionDao

public void setContentPermissionDao(ContentPermissionDao contentPermissionDao)

setPageManager

public void setPageManager(PageManager pageManager)

setContentPermissionSetDao

public void setContentPermissionSetDao(ContentPermissionSetDao contentPermissionSetDao)

setIndexer

public void setIndexer(ConfluenceIndexer indexer)

setEventManager

public void setEventManager(EventManager eventManager)

setInheritedContentPermissionManager

public void setInheritedContentPermissionManager(InheritedContentPermissionManager inheritedContentPermissionManager)

setUserAccessor

public void setUserAccessor(UserAccessor userAccessor)


Confluence is developed by Atlassian.