com.atlassian.confluence.core
Class DefaultContentPermissionManager

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

public class DefaultContentPermissionManager
extends Object
implements ContentPermissionManager


Field Summary
protected  ContentPermissionDao contentPermissionDao
           
 
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.
 AttachmentManager getAttachmentManager()
           
 List<ContentPermissionSet> getContentPermissionSets(ContentEntityObject ceo, String type)
          Get the ContentPermissionSets that affect this ceo, both inherited and directly.
 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<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
           
 List<ContentPermission> 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<Page> getPermittedChildren(Page page, com.atlassian.user.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(com.atlassian.user.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 setContentPermissions(Collection<ContentPermission> 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(com.atlassian.event.EventManager eventManager)
           
 void setIndexer(ConfluenceIndexer indexer)
           
 void setInheritedContentPermissionManager(InheritedContentPermissionManager inheritedContentPermissionManager)
           
 void setPageDao(PageDao pageDao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentPermissionDao

protected ContentPermissionDao contentPermissionDao
Constructor Detail

DefaultContentPermissionManager

public DefaultContentPermissionManager()
Method Detail

getInheritedContentPermissions

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

getInheritedContentUserPermissions

public List<ContentPermission> 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<ContentPermissionSet> 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<ContentPermissionSet> 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(com.atlassian.user.User user,
                                         String permissionType,
                                         ContentEntityObject contentEntityObject)
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
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

removeAllGroupPermissions

public void removeAllGroupPermissions(String groupName)
Description copied from interface: ContentPermissionManager
Remove all content permission associtated with a given group.

Specified by:
removeAllGroupPermissions in interface ContentPermissionManager

removeAllUserPermissions

public void removeAllUserPermissions(String userName)
Description copied from interface: ContentPermissionManager
Remove all content permission associtated with a given user.

Specified by:
removeAllUserPermissions 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
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.

setContentPermissions

public void setContentPermissions(Collection<ContentPermission> 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

getPermittedChildren

public List<Page> getPermittedChildren(Page page,
                                       com.atlassian.user.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.

Specified by:
getPermittedChildren in interface ContentPermissionManager

getViewContentPermissions

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

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

setContentPermissionDao

public void setContentPermissionDao(ContentPermissionDao contentPermissionDao)

setPageDao

public void setPageDao(PageDao pageDao)

setContentPermissionSetDao

public void setContentPermissionSetDao(ContentPermissionSetDao contentPermissionSetDao)

setIndexer

public void setIndexer(ConfluenceIndexer indexer)

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

setInheritedContentPermissionManager

public void setInheritedContentPermissionManager(InheritedContentPermissionManager inheritedContentPermissionManager)

setChangeIndexer

public void setChangeIndexer(ChangeIndexer changeIndexer)

getAttachmentManager

public AttachmentManager getAttachmentManager()


Copyright © 2003-2012 Atlassian. All Rights Reserved.