Class DenormalisedContentViewPermissionDao

java.lang.Object
com.atlassian.confluence.security.denormalisedpermissions.impl.content.dao.DenormalisedContentViewPermissionDao

public class DenormalisedContentViewPermissionDao extends Object
Dao for working with denormalised content view permissions.
Since:
7.11.0
  • Constructor Details

    • DenormalisedContentViewPermissionDao

      public DenormalisedContentViewPermissionDao(org.hibernate.SessionFactory sessionFactory)
  • Method Details

    • getSimpleContentIdsInRange

      public List<Long> getSimpleContentIdsInRange(Long fromId, Long toId)
    • getAllExistingSidsForPages

      public Map<Long,Set<Long>> getAllExistingSidsForPages(Collection<Long> pageIdList)
      Finds all sids having access to content pages. For better performance, it accepts a bunch of page ids and retrieves data in one request.
      Parameters:
      pageIdList - - set of page ids.
      Returns:
      map where key is the page id and the value is a set of sids having access to the required pages.
    • removeRecords

      public void removeRecords(Long pageId, Set<Long> sidIds)
      Removes records from denormalised view permissions table.
      Parameters:
      pageId - page id
      sidIds - set of sids to remove
    • removeAllDenormalisedRecordsForPages

      public void removeAllDenormalisedRecordsForPages(Set<Long> pageIdsToRemove)
    • removeAllSimpleContentRecordsForPages

      public void removeAllSimpleContentRecordsForPages(Set<Long> pageIdsToRemove)
    • add

      public void add(DenormalisedContentViewPermission denormalisedContentViewPermission)
      Adds a new record.
      Parameters:
      denormalisedContentViewPermission - record to add
    • add

      public void add(List<DenormalisedContentViewPermission> permissionsToAdd)
      Adds a list of records.
      Parameters:
      permissionsToAdd - list of records.
    • getVisiblePagesFromSpace

      public List<SimpleContent> getVisiblePagesFromSpace(long spaceId, Collection<Long> sidIdList, boolean permissionExempt)
      Returns all visible pages from space. Note that pages do not take into account parent permissions.
      Parameters:
      spaceId - space id
      sidIdList - sid ids
      permissionExempt -
      Returns:
      list of simple pages
    • getAllVisibleChildren

      public Map<Long,List<SimpleContent>> getAllVisibleChildren(Collection<Long> parentIds, Collection<Long> sidIdList, boolean permissionExempt)
      Returns all visible children for the provided set of parent ids
      Parameters:
      parentIds - parent ids
      sidIdList - sid ids
      permissionExempt -
      Returns:
      map where parent
    • getAllVisibleTopLevelPages

      public List<SimpleContent> getAllVisibleTopLevelPages(long spaceId, Set<Long> sids, boolean permissionExempt)
      Return all visible top-level pages.
      Parameters:
      spaceId - space id
      sids - sid ids
      permissionExempt - if true, permissions should not be checked
      Returns:
      visible top level pages
    • getDenormalisedContentList

      public List<SimpleContent> getDenormalisedContentList(Set<Long> pageIdSet)
      Returns a list of simple content pages.
    • saveSimpleContent

      public void saveSimpleContent(SimpleContent simpleContent)
    • getVisiblePages

      public Set<Long> getVisiblePages(Set<Long> sids, Set<Long> pageIds)
      Returns only visible pages from the provided page id list. It checks inherited permissions, but does not check space permissions. The idea is to get find all pages first and exclude not-visible pages (by checking only direct permissions). Then get their parents and check their direct permissions too. Kick out those pages whose parents are invisible. Repeat until we reach top-level ancestors for all the pages. At this moment we will have visible pages.
      Parameters:
      sids - sids sids
      pageIds - page ids pages ids to check
      Returns:
      visible page ids
      Since:
      7.12.0