Class DenormalisedSpacePermissionDao
- java.lang.Object
-
- com.atlassian.confluence.security.denormalisedpermissions.impl.space.dao.DenormalisedSpacePermissionDao
-
public class DenormalisedSpacePermissionDao extends Object
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:
SpacePermissionType
-
-
Field Summary
Fields Modifier and Type Field Description static long
ALL_AUTHENTICATED_USERS_SID
static long
ANONYMOUS_USERS_SID
static long
FULL_CONFLUENCE_ACCESS
-
Constructor Summary
Constructors Constructor Description DenormalisedSpacePermissionDao(org.hibernate.SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecord(DenormalisedSpacePermission spacePermission, SpacePermissionType spacePermissionType)
void
deleteFastSpacePermissionsForSpaces(SpacePermissionType spacePermissionType, Collection<Long> spaceIds)
Removes all fast space permissions for the provided list of space ids.Map<Long,List<DenormalisedSpacePermission>>
findPermissionsForSpaces(Set<Long> spaceIds, SpacePermissionType permissionType)
Retrieves all denormalised space permissions for the provided set of space idsSet<Long>
findPermittedSpaceIds(Set<Long> sids, Set<Long> spaceIds, SpacePermissionType permissionType)
Receives a set of space ids and returns only permitted ones.List<Space>
findPermittedSpaces(List<Long> sidList, SpacePermissionType permissionType)
Retrieves all permitted spaces, filtered by space permissions and sid listList<SpaceKeyWithPermission>
getAllSpacesKeysWithPermissionInfo(Set<Long> sids, SpacePermissionType permissionType)
Retrieves all space keys.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.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 filtersvoid
removeRecord(DenormalisedSpacePermission spacePermission, SpacePermissionType spacePermissionType)
-
-
-
Field Detail
-
ANONYMOUS_USERS_SID
public static final long ANONYMOUS_USERS_SID
- See Also:
- Constant Field Values
-
ALL_AUTHENTICATED_USERS_SID
public static final long ALL_AUTHENTICATED_USERS_SID
- See Also:
- Constant Field Values
-
FULL_CONFLUENCE_ACCESS
public static final long FULL_CONFLUENCE_ACCESS
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public List<Space> findPermittedSpaces(List<Long> sidList, SpacePermissionType permissionType)
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
-
-