public class

DefaultContentPermissionManager

extends Object
implements ContentPermissionManager
java.lang.Object
   ↳ com.atlassian.confluence.core.DefaultContentPermissionManager

Summary

Fields
protected ContentPermissionDao contentPermissionDao
Public Constructors
DefaultContentPermissionManager()
Public Methods
void addContentPermission(ContentPermission permission, ContentEntityObject content)
Adds a new current content permission to the CEO if it doesn't have it already.
AttachmentManager getAttachmentManager()
List<ContentPermissionSet> getContentPermissionSets(ContentEntityObject ceo, String type)
Get the ContentPermissionSets that affect this ceo, both inherited and directly.
List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
List<ContentPermission> 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<ContentPermission> getInheritedContentUserPermissions(ContentEntityObject contentEntityObject)
Filters the inherited content permission sets of a page for a list of inherited user permissions (of type VIEW_PERMISSION)
List<Page> getPermittedChildren(Page page, User user)
Returns a list of Page objects that are direct children of the passed in page.
Set<ContentPermission> getViewContentPermissions(Page page)
Get view permissions on this page and its ancestors.
boolean hasContentLevelPermission(User user, String permissionType, ContentEntityObject contentEntityObject)
fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.
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 contentPermission)
void setChangeIndexer(ChangeIndexer changeIndexer)
void setContentPermissionDao(ContentPermissionDao contentPermissionDao)
void setContentPermissionSetDao(ContentPermissionSetDao contentPermissionSetDao)
void setContentPermissions(Collection<ContentPermission> requiredPermissions, ContentEntityObject content, String type)
Set the Content Permissions on the CEO to be the list of ContentPermissions passed.
void setEventManager(EventManager eventManager)
void setIndexer(ConfluenceIndexer indexer)
void setInheritedContentPermissionManager(InheritedContentPermissionManager inheritedContentPermissionManager)
void setPageDao(PageDao pageDao)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.confluence.core.ContentPermissionManager

Fields

protected ContentPermissionDao contentPermissionDao

Public Constructors

public DefaultContentPermissionManager ()

Public Methods

public void addContentPermission (ContentPermission permission, ContentEntityObject content)

Adds a new current content permission to the CEO if it doesn't have it already.

Throws
IllegalArgumentException if content object does not correspond to the latest version of the content Permissions can only be added to the latest version of a ContentEntityObject.

public AttachmentManager getAttachmentManager ()

public 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 VIEW_PERMISSION or EDIT_PERMISSION
Returns

public List<ContentPermissionSet> getInheritedContentPermissionSets (ContentEntityObject contentEntityObject)

public List<ContentPermission> 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.

public List<ContentPermission> getInheritedContentUserPermissions (ContentEntityObject contentEntityObject)

Filters the inherited content permission sets of a page for a list of inherited user permissions (of type VIEW_PERMISSION)

public List<Page> getPermittedChildren (Page page, User user)

Returns a list of Page objects that are direct children of the passed in page. This method will only return the children the passed in user has permission to view.

public Set<ContentPermission> getViewContentPermissions (Page page)

Get view permissions on this page and its ancestors.

Returns
  • a list of ContentPermission instances

public boolean hasContentLevelPermission (User user, String permissionType, ContentEntityObject contentEntityObject)

fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.

Parameters
permissionType VIEW_PERMISSION or EDIT_PERMISSION
Returns
  • true if the user has the specified type of permission on the given content

public void removeAllGroupPermissions (String groupName)

Remove all content permission associtated with a given group.

public void removeAllUserPermissions (String userName)

Remove all content permission associtated with a given user.

public void removeContentPermission (ContentPermission contentPermission)

public void setChangeIndexer (ChangeIndexer changeIndexer)

public void setContentPermissionDao (ContentPermissionDao contentPermissionDao)

public void setContentPermissionSetDao (ContentPermissionSetDao contentPermissionSetDao)

public void setContentPermissions (Collection<ContentPermission> requiredPermissions, 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
requiredPermissions set of ContentPermissions

public void setEventManager (EventManager eventManager)

public void setIndexer (ConfluenceIndexer indexer)

public void setInheritedContentPermissionManager (InheritedContentPermissionManager inheritedContentPermissionManager)

public void setPageDao (PageDao pageDao)