Class DenormalisedContentPermissionsUpdater
- java.lang.Object
-
- com.atlassian.confluence.security.denormalisedpermissions.impl.content.DenormalisedContentPermissionsUpdater
-
@Internal public class DenormalisedContentPermissionsUpdater extends Object
Updates denormalised content view permissions in accordance with real permissions.- Since:
- 7.11.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INITIAL_CONTENT_PROCESSING_LIMIT
static int
PAGE_PROCESSING_BATCH_SIZE
The size of the page batch for updating permissions in one transaction.
-
Constructor Summary
Constructors Constructor Description DenormalisedContentPermissionsUpdater(org.springframework.transaction.PlatformTransactionManager platformTransactionManager, DenormalisedSidManager denormalisedSidManager, DenormalisedContentViewPermissionDao denormalisedContentViewPermissionDao, RealContentAndPermissionsDao realContentAndPermissionsDao)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
setInitialContentProcessingBatchSize(int limit)
int
updateAllContentPermissions(AtomicBoolean schedulingEnabled, Supplier<DenormalisedPermissionServiceState> contentServiceStateSupplier)
Updates all content permissions.Set<Long>
updateContentViewPermissions(Set<Long> pageIds, long deadline)
Updates denormalised content permissions for the set of page ids.
-
-
-
Field Detail
-
DEFAULT_INITIAL_CONTENT_PROCESSING_LIMIT
public static final int DEFAULT_INITIAL_CONTENT_PROCESSING_LIMIT
- See Also:
- Constant Field Values
-
PAGE_PROCESSING_BATCH_SIZE
public static final int PAGE_PROCESSING_BATCH_SIZE
The size of the page batch for updating permissions in one transaction. 1000 is used because any database support IN clause with 1000 elements.
-
-
Constructor Detail
-
DenormalisedContentPermissionsUpdater
public DenormalisedContentPermissionsUpdater(org.springframework.transaction.PlatformTransactionManager platformTransactionManager, DenormalisedSidManager denormalisedSidManager, DenormalisedContentViewPermissionDao denormalisedContentViewPermissionDao, RealContentAndPermissionsDao realContentAndPermissionsDao)
-
-
Method Detail
-
setInitialContentProcessingBatchSize
public static void setInitialContentProcessingBatchSize(int limit)
-
updateAllContentPermissions
public int updateAllContentPermissions(AtomicBoolean schedulingEnabled, Supplier<DenormalisedPermissionServiceState> contentServiceStateSupplier) throws ExecutionException, InterruptedException
Updates all content permissions. Content permissions are updated in batches, each batch is processed in its own separate transaction. First of all, we retrieve all real pages in batches of 10,000 pages. Then each batch is splitted into batches of 1000 elements. Then denormalised permissions are updated for each batch in its own transaction. If a server is restarted, we will need to repeat processing of the last 1000 pages. Denormalised permissions for all previously processed pages will not be lost.- Parameters:
schedulingEnabled
- Reference to DenormalisedChangeLogListenerBase#schedulingEnabled Scheduled task (cron) can be disabled mid-processing, so it's necessary to keep a reference and check this value periodically. For example, it would happen when Confluence is shutting down.- Throws:
ExecutionException
InterruptedException
-
updateContentViewPermissions
public Set<Long> updateContentViewPermissions(Set<Long> pageIds, long deadline)
Updates denormalised content permissions for the set of page ids.- Parameters:
pageIds
- set of page ids to processdeadline
- deadline. Should stop stop processing records after the deadline- Returns:
- processed page ids
-
-