Class DenormalisedSpacePermissionDao
java.lang.Object
com.atlassian.confluence.security.denormalisedpermissions.impl.space.dao.DenormalisedSpacePermissionDao
DAO for denormalised space permission table.
It works with several tables - one table per each permission type.
At this moment, two permission types, VIEWSPACE and EDITSPACE are supported.
- Since:
- 7.10.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
static final long
static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRecord
(DenormalisedSpacePermission spacePermission, SpacePermissionType spacePermissionType) void
deleteFastSpacePermissionsForSpaces
(SpacePermissionType spacePermissionType, Collection<Long> spaceIds) Removes all fast space permissions for the provided list of space ids.findPermissionsForSpaces
(Set<Long> spaceIds, SpacePermissionType permissionType) Retrieves all denormalised space permissions for the provided set of space idsfindPermittedSpaceIds
(Set<Long> sids, Set<Long> spaceIds, SpacePermissionType permissionType) Receives a set of space ids and returns only permitted ones.findPermittedSpaces
(List<Long> sidList, SpacePermissionType permissionType) Retrieves all permitted spaces, filtered by space permissions and sid listgetAllSpacesKeysWithPermissionInfo
(Set<Long> sids, SpacePermissionType permissionType) Retrieves all space keys.getOrphanSpacesInFastPermissions
(SpacePermissionType spacePermissionType, int limit) Returns the list of space id that do not exist in the DB anymore but fast space permissions still have references to them.getSpaces
(Set<Long> sids, SpacePermissionType permissionType, SpacesQuery spaceQuery, int offset, int limit, boolean permissionExempt) Returns a list of permitted spaces Spaces could be additionally filtered by provided optional filtersvoid
removeRecord
(DenormalisedSpacePermission spacePermission, SpacePermissionType spacePermissionType)
-
Field Details
-
ANONYMOUS_USERS_SID
public static final long ANONYMOUS_USERS_SID- See Also:
-
ALL_AUTHENTICATED_USERS_SID
public static final long ALL_AUTHENTICATED_USERS_SID- See Also:
-
FULL_CONFLUENCE_ACCESS
public static final long FULL_CONFLUENCE_ACCESS- See Also:
-
-
Constructor Details
-
DenormalisedSpacePermissionDao
public DenormalisedSpacePermissionDao(org.hibernate.SessionFactory sessionFactory)
-
-
Method Details
-
findPermissionsForSpaces
public Map<Long,List<DenormalisedSpacePermission>> findPermissionsForSpaces(Set<Long> spaceIds, SpacePermissionType permissionType) Retrieves all denormalised space permissions for the provided set of space ids- Parameters:
spaceIds
- set of space idspermissionType
- permission type (view permissions or edit permissions)- Returns:
- map where key is space id and value is a list of DenormalisedSpacePermission records
-
findPermittedSpaces
Retrieves all permitted spaces, filtered by space permissions and sid list- Parameters:
sidList
- sid listpermissionType
- permission type- Returns:
- permitted space list
-
findPermittedSpaceIds
public Set<Long> findPermittedSpaceIds(Set<Long> sids, Set<Long> spaceIds, SpacePermissionType permissionType) Receives a set of space ids and returns only permitted ones.- Parameters:
sids
- user sidspermissionType
- permission type- Returns:
- permitted space list
-
getAllSpacesKeysWithPermissionInfo
public List<SpaceKeyWithPermission> getAllSpacesKeysWithPermissionInfo(Set<Long> sids, SpacePermissionType permissionType) Retrieves all space keys. Each space key has a flag which indicates whether space is permitted or not- Parameters:
sids
- sid listpermissionType
- permission type- Returns:
- list if space keys with the corresponding permission statuses
-
removeRecord
public void removeRecord(DenormalisedSpacePermission spacePermission, SpacePermissionType spacePermissionType) -
addRecord
public void addRecord(DenormalisedSpacePermission spacePermission, SpacePermissionType spacePermissionType) -
getSpaces
public List<Space> getSpaces(Set<Long> sids, SpacePermissionType permissionType, SpacesQuery spaceQuery, int offset, int limit, boolean permissionExempt) Returns a list of permitted spaces Spaces could be additionally filtered by provided optional filters- Parameters:
sids
- sid id listpermissionType
- permission typespaceQuery
- space queryoffset
- offsetlimit
- limitpermissionExempt
- if true all spaces should be returned- Returns:
- space list
-
getOrphanSpacesInFastPermissions
public List<Long> getOrphanSpacesInFastPermissions(SpacePermissionType spacePermissionType, int limit) Returns the list of space id that do not exist in the DB anymore but fast space permissions still have references to them. -
deleteFastSpacePermissionsForSpaces
public void deleteFastSpacePermissionsForSpaces(SpacePermissionType spacePermissionType, Collection<Long> spaceIds) Removes all fast space permissions for the provided list of space ids.- Parameters:
spaceIds
- space ids
-