Package com.atlassian.confluence.core
Interface ContentPermissionManager
- All Known Subinterfaces:
ContentPermissionManagerInternal
- All Known Implementing Classes:
DefaultContentPermissionManager
@Transactional
public interface ContentPermissionManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddContentPermission(ContentPermission permission, ContentEntityObject content) Add permissions to the content entity objecct through the manager.voidCopies all content permissions from one content entity to another.voidcopyContentPermissions(AbstractPage from, AbstractPage to) Deprecated.getContentPermissionSets(ContentEntityObject ceo, String type) Get the ContentPermissionSets that affect this ceo, both inherited and directly.getInheritedContentPermissionSets(ContentEntityObject contentEntityObject) getInheritedContentPermissionSets(ContentEntityObject contentEntityObject, boolean includeEditPermissions) Get the inherited ContentPermissionSets that affect this ceo.getInheritedContentUserPermissions(ContentEntityObject contentEntityObject) getPermissionSets(ConfluenceUser user, Space space) Retrieves the configured permissions regarding whether the specified user can view the pages inside a space.getPermissionSets(com.atlassian.user.User user, Space space) Deprecated.since 8.8 usegetPermissionSets(ConfluenceUser, Space)getPermittedChildren(Page page, ConfluenceUser user) Returns a list ofPageobjects that are direct children of the passed in page.getPermittedChildren(Page page, com.atlassian.user.User user) Deprecated.since 8.8 usegetPermittedChildren(Page, ConfluenceUser)Gets the list of child pages under the given page that are visible to the given user.getPermittedChildrenIgnoreInheritedPermissions(Page page, com.atlassian.user.User user) Deprecated.Deprecated.since 5.8.booleanhasContentLevelPermission(ConfluenceUser user, String permissionType, ContentEntityObject content) fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.default booleanhasContentLevelPermission(com.atlassian.user.User user, String permissionType, ContentEntityObject content) Deprecated.booleanhasPermittedChildrenIgnoreInheritedPermissions(Page page, ConfluenceUser remoteUser) Does the given page have children visible to the given user.default booleanhasPermittedChildrenIgnoreInheritedPermissions(Page page, com.atlassian.user.User remoteUser) Deprecated.booleanisPermissionInherited(Page childPage) Does the child page get its permissions from any ancestor?booleanisSharedAccessAllowed(ConfluenceUser user, ContentEntityObject contentEntity) Checks if this draft can be accessed by users other than the creator (shared access)voidremoveAllGroupPermissions(String groupName) Remove all content permission associated with a given group.voidRemove all content permission associated with a given user.voidremoveContentPermission(ContentPermission permission) voidsetContentPermissions(@NonNull Map<String, Collection<ContentPermission>> requiredPermissionsMap, ContentEntityObject content) Set the Content Permissions on the CEO to be the list ofContentPermissions passed.voidsetContentPermissions(Collection<ContentPermission> contentPermissions, ContentEntityObject content, String type) Set the Content Permissions on the CEO to be the list ofContentPermissions passed.
-
Method Details
-
addContentPermission
Add permissions to the content entity objecct through the manager. This will ensure that already existing permissions are updated and that the content will be reindexed.- Parameters:
permission-content-
-
setContentPermissions
void setContentPermissions(Collection<ContentPermission> contentPermissions, ContentEntityObject content, String type) Set the Content Permissions on the CEO to be the list ofContentPermissions passed. Passing an empty list removes all permissions. Passing a list containing just the existing permissions does nothing.- Parameters:
contentPermissions- set ofContentPermissionscontent-type-
-
setContentPermissions
void setContentPermissions(@NonNull Map<String, Collection<ContentPermission>> requiredPermissionsMap, ContentEntityObject content) Set the Content Permissions on the CEO to be the list ofContentPermissions 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 thansetContentPermissions(java.util.Collection, ContentEntityObject, String)does- Parameters:
requiredPermissionsMap- - map ofContentPermissions for each typecontent-- Since:
- 5.8
-
removeContentPermission
-
removeAllGroupPermissions
Remove all content permission associated with a given group.- Parameters:
groupName-
-
removeAllUserPermissions
Remove all content permission associated with a given user.- Parameters:
user-- Since:
- 5.3
-
getInheritedContentUserPermissions
@Transactional(readOnly=true) List<ContentPermission> getInheritedContentUserPermissions(ContentEntityObject contentEntityObject) -
getInheritedContentPermissionSets
@Transactional(readOnly=true) List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject) - Returns:
- a list of
ContentPermissionSets of typeContentPermission.VIEW_PERMISSIONof all ancestors of contentEntityObject
-
hasContentLevelPermission
boolean hasContentLevelPermission(ConfluenceUser user, String permissionType, ContentEntityObject content) fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.- Parameters:
permissionType-ContentPermission.VIEW_PERMISSIONorContentPermission.EDIT_PERMISSION- Returns:
- true if the user has the specified type of permission on the given content
- Since:
- 8.8
-
hasContentLevelPermission
@Deprecated default boolean hasContentLevelPermission(com.atlassian.user.User user, String permissionType, ContentEntityObject content) Deprecated.fetches the inherited and explicit content level permissions for this content object and determines whether the user has access.- Parameters:
permissionType-ContentPermission.VIEW_PERMISSIONorContentPermission.EDIT_PERMISSION- Returns:
- true if the user has the specified type of permission on the given content
-
getPermittedChildren
Returns a list ofPageobjects that are direct children of the passed in page. This method will only return the children the passed in user has permission to view.- Since:
- 8.8
-
getPermittedChildren
@Transactional(readOnly=true) @Deprecated default List<Page> getPermittedChildren(Page page, com.atlassian.user.User user) Deprecated.since 8.8 usegetPermittedChildren(Page, ConfluenceUser)Returns a list ofPageobjects that are direct children of the passed in page. This method will only return the children the passed in user has permission to view. -
hasPermittedChildrenIgnoreInheritedPermissions
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.- Since:
- 8.8
-
hasPermittedChildrenIgnoreInheritedPermissions
@Deprecated default boolean hasPermittedChildrenIgnoreInheritedPermissions(Page page, com.atlassian.user.User remoteUser) Deprecated.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. -
getPermittedChildrenIgnoreInheritedPermissions
@Transactional(readOnly=true) List<Page> getPermittedChildrenIgnoreInheritedPermissions(Page page, ConfluenceUser user) Gets the list of child pages under the given page that are 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.- Since:
- 8.8
-
getPermittedChildrenIgnoreInheritedPermissions
@Transactional(readOnly=true) @Deprecated default List<Page> getPermittedChildrenIgnoreInheritedPermissions(Page page, com.atlassian.user.User user) Deprecated.Gets the list of child pages under the given page that are 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.- Since:
- 5.10
-
getViewContentPermissions
@Deprecated @Transactional(readOnly=true) Set<ContentPermission> getViewContentPermissions(Page page) Deprecated.since 5.8. usegetContentPermissionSets(ContentEntityObject, String)passing permission typeContentPermission.VIEW_PERMISSIONGet view permissions on this page and its ancestors.- Parameters:
page-- Returns:
- a list of ContentPermission instances
-
getInheritedContentPermissionSets
@Transactional(readOnly=true) List<ContentPermissionSet> getInheritedContentPermissionSets(ContentEntityObject contentEntityObject, boolean includeEditPermissions) Get the inherited ContentPermissionSets that affect this ceo. Note that EDIT Permissions are not currently inherited, however edit permissions are treated as view permissions when considering inheritance, unless the boolean 'includeEditPermissions' is set to false.- Parameters:
contentEntityObject- whose permissions will be returned. Not null.includeEditPermissions- which specifies whether or not edit permissions should be additionally treated as view permissions.- Returns:
- a list of
ContentPermissionSets. Not null, but can be empty. - Since:
- 5.8
-
getContentPermissionSets
@Transactional(readOnly=true) 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 ofContentPermission.VIEW_PERMISSIONorContentPermission.EDIT_PERMISSION- Returns:
- a list of
ContentPermissionSets. Not null, but can be empty.
-
isPermissionInherited
Does the child page get its permissions from any ancestor?- Parameters:
childPage-- Returns:
- boolean True if the child page does not have a view permission set, and an ancestor does.
-
copyContentPermissions
Deprecated.since 5.10.1 usecopyContentPermissions(ContentEntityObject, ContentEntityObject)Copies all content permissions from one page to another.- Since:
- 5.10
-
copyContentPermissions
Copies all content permissions from one content entity to another.- Since:
- 5.10.1
-
getPermissionSets
Retrieves the configured permissions regarding whether the specified user can view the pages inside a space. If a page is not configured in the tables - CONTENT_PERM_SET and CONTENT_PERM, then the permission of that page will not be included here. Note: the permission returned here does not consider the inherited permission from parent page.- Parameters:
user- - confluence user to be checkedspace- - confluence space- Returns:
- a Map where the key is the page id and the value indicates the view permission.
- Since:
- 8.8
-
getPermissionSets
@Transactional(readOnly=true) @Deprecated default Map<Long,Boolean> getPermissionSets(com.atlassian.user.User user, Space space) Deprecated.since 8.8 usegetPermissionSets(ConfluenceUser, Space)Retrieves the configured permissions regarding whether the specified user can view the pages inside a space. If a page is not configured in the tables - CONTENT_PERM_SET and CONTENT_PERM, then the permission of that page will not be included here. Note: the permission returned here does not consider the inherited permission from parent page.- Parameters:
user- - confluence user to be checkedspace- - confluence space- Returns:
- a Map where the key is the page id and the value indicates the view permission.
- Since:
- 5.10.8
-
copyContentPermissions(ContentEntityObject, ContentEntityObject)