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 Summary
Constructors Constructor Description DenormalisedContentViewPermissionDao(org.hibernate.SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(DenormalisedContentViewPermission denormalisedContentViewPermission)
Adds a new record.void
add(List<DenormalisedContentViewPermission> permissionsToAdd)
Adds a list of records.Map<Long,Set<Long>>
getAllExistingSidsForPages(Collection<Long> pageIdList)
Finds all sids having access to content pages.Map<Long,List<SimpleContent>>
getAllVisibleChildren(Collection<Long> parentIds, Collection<Long> sidIdList, boolean permissionExempt)
Returns all visible children for the provided set of parent idsList<SimpleContent>
getAllVisibleTopLevelPages(long spaceId, Set<Long> sids, boolean permissionExempt)
Return all visible top-level pages.List<SimpleContent>
getDenormalisedContentList(Set<Long> pageIdSet)
Returns a list of simple content pages.List<Long>
getSimpleContentIdsInRange(Long fromId, Long toId)
Set<Long>
getVisiblePages(Set<Long> sids, Set<Long> pageIds)
Returns only visible pages from the provided page id list.List<SimpleContent>
getVisiblePagesFromSpace(long spaceId, Collection<Long> sidIdList, boolean permissionExempt)
Returns all visible pages from space.void
removeAllDenormalisedRecordsForPages(Set<Long> pageIdsToRemove)
void
removeAllSimpleContentRecordsForPages(Set<Long> pageIdsToRemove)
void
removeRecords(Long pageId, Set<Long> sidIds)
Removes records from denormalised view permissions table.void
saveSimpleContent(SimpleContent simpleContent)
-
-
-
Method Detail
-
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 idsidIds
- 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 idsidIdList
- sid idspermissionExempt
-- 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 idssidIdList
- sid idspermissionExempt
-- 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 idsids
- sid idspermissionExempt
- 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 sidspageIds
- page ids pages ids to check- Returns:
- visible page ids
- Since:
- 7.12.0
-
-