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:
  • 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 ids
      permissionType - 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 list
      permissionType - 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 sids
      permissionType - 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 list
      permissionType - 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 list
      permissionType - permission type
      spaceQuery - space query
      offset - offset
      limit - limit
      permissionExempt - 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