com.atlassian.confluence.core
Class DefaultContentPermissionManager

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

public class DefaultContentPermissionManager
extends java.lang.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()
           
 java.util.List<ContentPermissionSet> getContentPermissionSets(ContentEntityObject ceo, java.lang.String type)
          Get the ContentPermissionSets that affect this ceo, both inherited and directly.
 java.util.List<ContentPermission> getInheritedContentPermissions(ContentEntityObject contentEntityObject)
          Deprecated. 
 java.util.List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
           
 java.util.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)
 java.util.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.
 java.util.Set<ContentPermission> getViewContentPermissions(Page page)
          Get view permissions on this page and its ancestors.
 boolean hasContentLevelPermission(com.atlassian.user.User user, java.lang.String permissionType, ContentEntityObject contentEntityObject)
          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 user)
          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(java.lang.String groupName)
          Remove all content permission associated with a given group.
 void removeAllUserPermissions(ConfluenceUser user)
          Remove all content permission associated with a given user.
 void removeAllUserPermissions(java.lang.String userName)
          Deprecated. 
 void removeContentPermission(ContentPermission contentPermission)
           
 void setChangeIndexer(ChangeIndexer changeIndexer)
           
 void setContentPermissionDao(ContentPermissionDao contentPermissionDao)
           
 void setContentPermissions(java.util.Collection<ContentPermission> requiredPermissions, ContentEntityObject content, java.lang.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

@Deprecated
public java.util.List<ContentPermission> getInheritedContentPermissions(ContentEntityObject contentEntityObject)
Deprecated. 

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 java.util.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 java.util.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 java.util.List<ContentPermissionSet> getContentPermissionSets(ContentEntityObject ceo,
                                                                     java.lang.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,
                                         java.lang.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(java.lang.String groupName)
Description copied from interface: ContentPermissionManager
Remove all content permission associated with a given group.

Specified by:
removeAllGroupPermissions in interface ContentPermissionManager

removeAllUserPermissions

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

Specified by:
removeAllUserPermissions in interface ContentPermissionManager

removeAllUserPermissions

@Deprecated
public void removeAllUserPermissions(java.lang.String userName)
Deprecated. 

Description copied from interface: ContentPermissionManager
Remove all content permission associated 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:
java.lang.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(java.util.Collection<ContentPermission> requiredPermissions,
                                  ContentEntityObject content,
                                  java.lang.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 java.util.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

hasPermittedChildrenIgnoreInheritedPermissions

public boolean hasPermittedChildrenIgnoreInheritedPermissions(Page page,
                                                              com.atlassian.user.User user)
Description copied from interface: ContentPermissionManager
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.

Specified by:
hasPermittedChildrenIgnoreInheritedPermissions in interface ContentPermissionManager

getViewContentPermissions

public java.util.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()

isPermissionInherited

public boolean isPermissionInherited(Page childPage)
Description copied from interface: ContentPermissionManager
Does the child page get its permissions from any ancestor?

Specified by:
isPermissionInherited in interface ContentPermissionManager
Returns:
boolean True if the child page does not have a view permission set, and an ancestor does.


Copyright © 2003-2014 Atlassian. All Rights Reserved.