com.atlassian.confluence.core
Class DefaultContentPermissionManager

java.lang.Object
  extended by com.atlassian.confluence.core.DefaultContentEntityManager
      extended by com.atlassian.confluence.core.DefaultContentPermissionManager
All Implemented Interfaces:
ContentEntityManager, ContentPermissionManager
Direct Known Subclasses:
CachingContentPermissionManager

public class DefaultContentPermissionManager
extends DefaultContentEntityManager
implements ContentPermissionManager


Field Summary
protected  ContentPermissionDao contentPermissionDao
           
protected  PageManager pageManager
           
 
Fields inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
contentEntityObjectDao, eventManager, indexer, linkManager
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Constructor Summary
DefaultContentPermissionManager()
           
 
Method Summary
 void addContentPermission(ContentPermission permission, ContentEntityObject content)
          Adds a new current content permission to the CEO.
protected  boolean cannotHaveInheritedPermissions(ContentEntityObject contentEntityObject)
          Check (for speed) whether we should even both to query for possible inherited permissions.
 ContentPermission getContentUserPermission(ContentEntityObject contentEntityObject)
          If a page has inherited _user_ permissions, the one that applies is the top most one else, just return the user permission currently attached to the page

This is a convenience method to encapsulate this logic.

 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 getInheritedContentUserPermissions(ContentEntityObject contentEntityObject)
          Filters the inherited permissions of a page for a list of inherited user permissions
 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 onContentContextChanged(ContentEntityObject contentEntityObject)
          Method to notify the permission manager that the 'context' of the content has changed.
 void removeContentPermission(ContentPermission permission)
           
 void saveContentPermission(ContentPermission permission)
           
 void setContentPermissionDao(ContentPermissionDao contentPermissionDao)
           
 void setPageManager(PageManager pageManager)
           
 
Methods inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
getAllCurrentEntities, getById, getEntitiesModifiedSince, getEventManager, getLockedBySpace, getNextVersion, getOtherVersion, getPageDao, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesByType, getRecentlyModifiedEntitiesForUser, getVersionHistorySummaries, publishCreateEvent, publishRemoveEvent, publishUpdateEvent, refreshContentEntity, removeContentEntity, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, setContentEntityObjectDao, setEventManager, setIndexer, setLabelManager, setLinkManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentPermissionDao

protected ContentPermissionDao contentPermissionDao

pageManager

protected PageManager pageManager
Constructor Detail

DefaultContentPermissionManager

public DefaultContentPermissionManager()
Method Detail

saveContentPermission

public void saveContentPermission(ContentPermission permission)
Specified by:
saveContentPermission in interface ContentPermissionManager

getInheritedContentPermissions

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

Specified by:
getInheritedContentPermissions in interface ContentPermissionManager
Parameters:
contentEntityObject -

cannotHaveInheritedPermissions

protected boolean cannotHaveInheritedPermissions(ContentEntityObject contentEntityObject)
Check (for speed) whether we should even both 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 permissions of a page for a list of inherited user permissions

Specified by:
getInheritedContentUserPermissions in interface ContentPermissionManager
Parameters:
contentEntityObject -

getContentUserPermission

public ContentPermission getContentUserPermission(ContentEntityObject contentEntityObject)
If a page has inherited _user_ permissions, the one that applies is the top most one else, just return the user permission currently attached to the page

This is a convenience method to encapsulate this logic.

Specified by:
getContentUserPermission in interface ContentPermissionManager
Parameters:
contentEntityObject -

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
Returns:

removeContentPermission

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

addContentPermission

public void addContentPermission(ContentPermission permission,
                                 ContentEntityObject content)
Adds a new current content permission to the CEO. If a current permission already exists on the object, we will update it.

Specified by:
addContentPermission in interface ContentPermissionManager
Parameters:
permission -
content -

getPermittedChildren

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

getInheritedViewContentPermissions

public List getInheritedViewContentPermissions(Page page)
Description copied from interface: ContentPermissionManager
only get inherited permissions that are restrict the viewing of pages

Specified by:
getInheritedViewContentPermissions in interface ContentPermissionManager
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
Returns:
a list of ContentPermission instances

onContentContextChanged

public void onContentContextChanged(ContentEntityObject contentEntityObject)
Description copied from interface: ContentPermissionManager
Method to notify the permission manager that the 'context' of the content has changed. For example when a Page hierarchy is moved from a parent page to another.

Specified by:
onContentContextChanged in interface ContentPermissionManager
Parameters:
contentEntityObject - the content for which the context changed.

setContentPermissionDao

public void setContentPermissionDao(ContentPermissionDao contentPermissionDao)

setPageManager

public void setPageManager(PageManager pageManager)


Confluence is developed by Atlassian.