Class DenormalisedPermissionRouter
- java.lang.Object
-
- com.atlassian.confluence.security.denormalisedpermissions.impl.DenormalisedPermissionRouter
-
- All Implemented Interfaces:
BulkPermissionService
public class DenormalisedPermissionRouter extends Object implements BulkPermissionService
A router which either sends requests to real denormalised permissions service or to "fallback" service.- Since:
- 7.11.0
-
-
Constructor Summary
Constructors Constructor Description DenormalisedPermissionRouter(BulkPermissionService realDenormalisedPermissionService, BulkPermissionService fallbackDenormalisedPermissionService, DenormalisedPermissionStateManager denormalisedPermissionStateManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Boolean>
getAllSpaceKeysWithPermissionStatuses(@Nullable ConfluenceUser confluenceUser, String spacePermissionType)
Returns a map of spaces where key is space key, and value is flag (true if permitted, false is not)List<SimpleContent>
getAllVisiblePagesInSpace(@Nullable ConfluenceUser confluenceUser, long spaceId)
Returns the full list of visible pages in the space.Set<Long>
getPermittedSpaceIds(@Nullable ConfluenceUser confluenceUser, Set<Long> spaceIds, String spacePermissionType)
Returns a set of permitted space ids.List<Space>
getPermittedSpaces(SpacesQuery spaceQuery, int offset, int limit)
Returns a list of permitted spaces filters by spaceQuery.Map<Long,List<SimpleContent>>
getVisibleChildPages(@Nullable ConfluenceUser confluenceUser, Set<Long> parentPageIdSet, boolean checkInheritedPermissions)
Receives a set of page ids as a parameter and finds all visible children for them.Set<Long>
getVisiblePageIds(@Nullable ConfluenceUser confluenceUser, Set<Long> pageIds, boolean checkSpacePermissions)
Returns a set of visible page ids.List<SimpleContent>
getVisibleTopLevelPages(@Nullable ConfluenceUser confluenceUser, long spaceId)
Finds all visible top-level pages.void
sendAnalyticsEventAboutFailure(DenormalisedPermissionFailAnalyticsEvent.Action action)
-
-
-
Constructor Detail
-
DenormalisedPermissionRouter
public DenormalisedPermissionRouter(BulkPermissionService realDenormalisedPermissionService, BulkPermissionService fallbackDenormalisedPermissionService, DenormalisedPermissionStateManager denormalisedPermissionStateManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Detail
-
getAllSpaceKeysWithPermissionStatuses
public Map<String,Boolean> getAllSpaceKeysWithPermissionStatuses(@Nullable ConfluenceUser confluenceUser, String spacePermissionType)
Returns a map of spaces where key is space key, and value is flag (true if permitted, false is not)- Specified by:
getAllSpaceKeysWithPermissionStatuses
in interfaceBulkPermissionService
- Parameters:
confluenceUser
- confluence user.spacePermissionType
- - permission type. Only "VIEWSPACE" or "EDITSPACE" are supported- Returns:
- map of spaces with their permission statuses
-
getPermittedSpaces
public List<Space> getPermittedSpaces(SpacesQuery spaceQuery, int offset, int limit)
Returns a list of permitted spaces filters by spaceQuery.- Specified by:
getPermittedSpaces
in interfaceBulkPermissionService
- Parameters:
spaceQuery
- queryoffset
- offset for the querylimit
- maxResults for the query. Must be greater than 0- Returns:
- list of permitted filtered spaces
-
getPermittedSpaceIds
public Set<Long> getPermittedSpaceIds(@Nullable ConfluenceUser confluenceUser, Set<Long> spaceIds, String spacePermissionType)
Returns a set of permitted space ids.- Specified by:
getPermittedSpaceIds
in interfaceBulkPermissionService
- Parameters:
confluenceUser
- confluence user.spaceIds
- space ids.spacePermissionType
- - permission type. Only "VIEWSPACE" or "EDITSPACE" are supported.- Returns:
- set of permitted spaces
- Since:
- 7.12.0
-
getVisibleChildPages
public Map<Long,List<SimpleContent>> getVisibleChildPages(@Nullable ConfluenceUser confluenceUser, Set<Long> parentPageIdSet, boolean checkInheritedPermissions)
Receives a set of page ids as a parameter and finds all visible children for them. Users from "confluence-administrators" group are exempt from permission checks - they will get all existing pages.- Specified by:
getVisibleChildPages
in interfaceBulkPermissionService
- Parameters:
confluenceUser
- the Confluence user, null if anonymousparentPageIdSet
- set of parent page ids- Returns:
- a list of
SimpleContent
entities representing the child pages visible to the user
-
getVisibleTopLevelPages
public List<SimpleContent> getVisibleTopLevelPages(@Nullable ConfluenceUser confluenceUser, long spaceId)
Finds all visible top-level pages. Users from "confluence-administrators" group are exempt from permission checks - they will get all existing pages.- Specified by:
getVisibleTopLevelPages
in interfaceBulkPermissionService
- Parameters:
confluenceUser
- the Confluence user, null if anonymousspaceId
- the space ID- Returns:
- a list of
SimpleContent
entities representing the child pages visible to the user
-
getAllVisiblePagesInSpace
public List<SimpleContent> getAllVisiblePagesInSpace(@Nullable ConfluenceUser confluenceUser, long spaceId)
Returns the full list of visible pages in the space. Users from "confluence-administrators" group are exempt from permission checks - they will get all existing pages.- Specified by:
getAllVisiblePagesInSpace
in interfaceBulkPermissionService
- Parameters:
confluenceUser
- the Confluence user, null if anonymousspaceId
- the space ID- Returns:
- a list of
SimpleContent
entities representing all pages visible to the user in a space
-
getVisiblePageIds
public Set<Long> getVisiblePageIds(@Nullable ConfluenceUser confluenceUser, Set<Long> pageIds, boolean checkSpacePermissions)
Returns a set of visible page ids. checkSpacePermissions must be set to true if permissions for spaces were not checked. checkSpacePermissions can be set to false if we already checked permissions for the their spaces. It allows to avoid unnecessary SQL qeueries.- Specified by:
getVisiblePageIds
in interfaceBulkPermissionService
- Parameters:
confluenceUser
- confluence user.pageIds
- page ids.checkSpacePermissions
- if false, "useConfluence" and corresponding space permissions will NOT be checked. If true, "useConfluence" and corresponding space permissions will be checked too.- Returns:
- set of visible page ids
- Since:
- 7.12.0
-
sendAnalyticsEventAboutFailure
@Internal public void sendAnalyticsEventAboutFailure(DenormalisedPermissionFailAnalyticsEvent.Action action)
-
-