public class DefaultContentPermissionManager extends Object implements ContentPermissionManagerInternal, org.springframework.beans.factory.DisposableBean
Modifier and Type | Field and Description |
---|---|
protected ContentPermissionDao |
contentPermissionDao |
Constructor and Description |
---|
DefaultContentPermissionManager() |
Modifier and Type | Method and Description |
---|---|
void |
addContentPermission(ContentPermission permission,
ContentEntityObject content)
Adds a new current content permission to the CEO if it doesn't have it
already.
|
void |
copyContentPermissions(AbstractPage from,
AbstractPage to)
Copies all content permissions from one page to another.
|
void |
copyContentPermissions(ContentEntityObject from,
ContentEntityObject to)
Copies all content permissions from one content entity to another.
|
void |
destroy() |
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<ContentPermissionSet> |
getInheritedContentPermissionSets(ContentEntityObject contentEntityObject,
boolean includeEditPermissions)
Get the inherited ContentPermissionSets that affect this ceo.
|
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 ) |
Map<Long,Boolean> |
getPermissionSets(com.atlassian.user.User user,
Space space)
Retrieves the configured permissions regarding whether the specified user can view the pages inside a space.
|
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. |
List<Page> |
getPermittedChildrenIgnoreInheritedPermissions(Page page,
com.atlassian.user.User user)
Gets the list of child pages under the given page that are visible to the given user.
|
List<Page> |
getPermittedPagesIgnoreInheritedPermissions(List<Page> contentList,
ConfluenceUser user,
String permission)
Check permissions for a collection of objects without checking permissions of ancestors and spaces.
|
Set<ContentPermission> |
getViewContentPermissions(Page page)
Deprecated.
since 5.8. use
getContentPermissionSets(ContentEntityObject, String) passing permission type ContentPermission.VIEW_PERMISSION |
Map<Long,ValidationResult> |
hasContentLevelPermission(ConfluenceUser user,
String permissionType,
Collection<Long> contentIds)
Check permission for a collection of content at once.
|
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.
|
boolean |
hasPermittedChildrenIgnoreInheritedPermissions(Page page,
com.atlassian.user.User user)
Does the given page have children visible to the given user.
|
boolean |
hasVisibleChildren(Page page,
ConfluenceUser user)
Returns true if at least one child is visible
This method does not check all children, it stops working when the first visible children is found
|
boolean |
isPermissionInherited(Page childPage)
Does the child page get its permissions from any ancestor?
|
void |
onContentPermissionEvent(ContentPermissionEvent contentPermissionEvent) |
void |
removeAllGroupPermissions(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 |
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
ContentPermission s passed. |
void |
setContentPermissions(@NonNull Map<String,Collection<ContentPermission>> requiredPermissionsMap,
ContentEntityObject content)
Set the Content Permissions on the CEO to be the list of
ContentPermission s passed. |
void |
setContentPermissionSetDao(ContentPermissionSetDao contentPermissionSetDao) |
void |
setEventListenerRegistrar(com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar) |
void |
setEventManager(com.atlassian.event.EventManager eventManager) |
void |
setIndexer(ConfluenceIndexer indexer) |
void |
setInheritedContentPermissionManager(InheritedContentPermissionManager inheritedContentPermissionManager) |
void |
setPageDao(PageDao pageDao) |
protected ContentPermissionDao contentPermissionDao
@EventListener public void onContentPermissionEvent(ContentPermissionEvent contentPermissionEvent)
public List<ContentPermission> getInheritedContentUserPermissions(ContentEntityObject contentEntityObject)
ContentPermission.VIEW_PERMISSION
)getInheritedContentUserPermissions
in interface ContentPermissionManager
public List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject)
getInheritedContentPermissionSets
in interface ContentPermissionManager
ContentPermissionSet
s of type
ContentPermission.VIEW_PERMISSION
of all ancestors of contentEntityObjectpublic List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject, boolean includeEditPermissions)
ContentPermissionManager
getInheritedContentPermissionSets
in interface ContentPermissionManager
contentEntityObject
- whose permissions will be returned. Not null.includeEditPermissions
- which specifies whether or not edit permissions should be additionally treated as view permissions.ContentPermissionSet
s. Not null, but can be empty.public List<ContentPermissionSet> getContentPermissionSets(ContentEntityObject ceo, String type)
ContentPermissionManager
getContentPermissionSets
in interface ContentPermissionManager
ceo
- whose permissions will be returned. Not null.type
- one of ContentPermission.VIEW_PERMISSION
or ContentPermission.EDIT_PERMISSION
ContentPermissionSet
s. Not null, but can be empty.public boolean hasContentLevelPermission(com.atlassian.user.User user, String permissionType, ContentEntityObject contentEntityObject)
ContentPermissionManager
hasContentLevelPermission
in interface ContentPermissionManager
permissionType
- ContentPermission.VIEW_PERMISSION
or ContentPermission.EDIT_PERMISSION
public void removeContentPermission(ContentPermission contentPermission)
removeContentPermission
in interface ContentPermissionManager
public void removeAllGroupPermissions(String groupName)
ContentPermissionManager
removeAllGroupPermissions
in interface ContentPermissionManager
public void removeAllUserPermissions(ConfluenceUser user)
ContentPermissionManager
removeAllUserPermissions
in interface ContentPermissionManager
public void addContentPermission(ContentPermission permission, ContentEntityObject content)
addContentPermission
in interface ContentPermissionManager
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 void setContentPermissions(@NonNull Map<String,Collection<ContentPermission>> requiredPermissionsMap, ContentEntityObject content)
ContentPermissionManager
ContentPermission
s passed. Passing
an empty list removes all permissions. Passing a list containing just the existing permissions does nothing.
It is recommended to use this method for setting different types of content permissions in a batch, because
it performs more smart and performant caching updates than ContentPermissionManager.setContentPermissions(java.util.Collection, ContentEntityObject, String)
doessetContentPermissions
in interface ContentPermissionManager
requiredPermissionsMap
- - map of ContentPermission
s for each typepublic void setContentPermissions(Collection<ContentPermission> requiredPermissions, ContentEntityObject content, String type)
ContentPermissionManager
ContentPermission
s passed. Passing
an empty list removes all permissions. Passing a list containing just the existing permissions does nothing.setContentPermissions
in interface ContentPermissionManager
requiredPermissions
- set of ContentPermission
spublic List<Page> getPermittedChildren(Page page, com.atlassian.user.User user)
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.getPermittedChildren
in interface ContentPermissionManager
public List<Page> getPermittedChildrenIgnoreInheritedPermissions(Page page, com.atlassian.user.User user)
ContentPermissionManager
getPermittedChildrenIgnoreInheritedPermissions
in interface ContentPermissionManager
public boolean hasPermittedChildrenIgnoreInheritedPermissions(Page page, com.atlassian.user.User user)
ContentPermissionManager
hasPermittedChildrenIgnoreInheritedPermissions
in interface ContentPermissionManager
@Deprecated public Set<ContentPermission> getViewContentPermissions(Page page)
getContentPermissionSets(ContentEntityObject, String)
passing permission type ContentPermission.VIEW_PERMISSION
getViewContentPermissions
in interface ContentPermissionManager
public void setContentPermissionDao(ContentPermissionDao contentPermissionDao)
public void setPageDao(PageDao pageDao)
public void setContentPermissionSetDao(ContentPermissionSetDao contentPermissionSetDao)
public void setIndexer(ConfluenceIndexer indexer)
public void setEventManager(com.atlassian.event.EventManager eventManager)
public void setInheritedContentPermissionManager(InheritedContentPermissionManager inheritedContentPermissionManager)
public void setChangeIndexer(ChangeIndexer changeIndexer)
public void setEventListenerRegistrar(com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar)
public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
public AttachmentManager getAttachmentManager()
public boolean isPermissionInherited(Page childPage)
ContentPermissionManager
isPermissionInherited
in interface ContentPermissionManager
public void copyContentPermissions(AbstractPage from, AbstractPage to)
ContentPermissionManager
copyContentPermissions
in interface ContentPermissionManager
public void copyContentPermissions(ContentEntityObject from, ContentEntityObject to)
ContentPermissionManager
copyContentPermissions
in interface ContentPermissionManager
public Map<Long,Boolean> getPermissionSets(com.atlassian.user.User user, Space space)
ContentPermissionManager
getPermissionSets
in interface ContentPermissionManager
user
- - confluence user to be checkedspace
- - confluence spacepublic Map<Long,ValidationResult> hasContentLevelPermission(ConfluenceUser user, String permissionType, Collection<Long> contentIds)
ContentPermissionManagerInternal
hasContentLevelPermission
in interface ContentPermissionManagerInternal
permissionType
- string needs to be one of the permission constants in ContentPermissionpublic List<Page> getPermittedPagesIgnoreInheritedPermissions(List<Page> contentList, ConfluenceUser user, String permission)
getPermittedPagesIgnoreInheritedPermissions
in interface ContentPermissionManagerInternal
public boolean hasVisibleChildren(Page page, ConfluenceUser user)
hasVisibleChildren
in interface ContentPermissionManagerInternal
Copyright © 2003–2020 Atlassian. All rights reserved.