Class DenormalisedSpacePermissionsUpdater
java.lang.Object
com.atlassian.confluence.security.denormalisedpermissions.impl.space.DenormalisedSpacePermissionsUpdater
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean
public class DenormalisedSpacePermissionsUpdater
extends Object
implements org.springframework.beans.factory.DisposableBean
Updates denormalised space view and edit permissions
- Since:
- 7.10.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDenormalisedSpacePermissionsUpdater
(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedSpacePermissionDao denormalisedSpacePermissionDao, SpacePermissionDao spacePermissionDao, DenormalisedSidManager denormalisedSidManager, org.springframework.transaction.PlatformTransactionManager platformTransactionManager, SpaceDaoInternal spaceDao) -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
handleSpacePermissionChangeEvent
(SpacePermissionChangeEvent spacePermissionChangeEvent) void
init()
static void
setInitialSpaceProcessingLimit
(int limit) int
updateAllSpacePermissions
(AtomicBoolean schedulingEnabled, Supplier<DenormalisedPermissionServiceState> spaceServiceStateSupplier) Updates all space permissions.updateSpacePermissions
(Set<Long> spaceIds) Calculates effective permissions for spaces and updates denormalised space permission records.updateSpacePermissions
(Set<Long> spaceIds, Long deadline) Calculates effective permissions for spaces and updates denormalised space permission records.
-
Field Details
-
DEFAULT_INITIAL_SPACE_PROCESSING_LIMIT
public static final int DEFAULT_INITIAL_SPACE_PROCESSING_LIMIT- See Also:
-
-
Constructor Details
-
DenormalisedSpacePermissionsUpdater
public DenormalisedSpacePermissionsUpdater(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedSpacePermissionDao denormalisedSpacePermissionDao, SpacePermissionDao spacePermissionDao, DenormalisedSidManager denormalisedSidManager, org.springframework.transaction.PlatformTransactionManager platformTransactionManager, SpaceDaoInternal spaceDao)
-
-
Method Details
-
setInitialSpaceProcessingLimit
public static void setInitialSpaceProcessingLimit(int limit) -
init
@PostConstruct public void init() -
handleSpacePermissionChangeEvent
@EventListener public void handleSpacePermissionChangeEvent(SpacePermissionChangeEvent spacePermissionChangeEvent) -
updateSpacePermissions
Calculates effective permissions for spaces and updates denormalised space permission records.- Parameters:
spaceIds
- list of space id for updating- Returns:
- list of processed spaces
-
updateSpacePermissions
Calculates effective permissions for spaces and updates denormalised space permission records. As this method could process a lot of spaces at once, the processing must be stopped after the deadline. But the current space processing must be finished, so the denormalised data will be consistent.- Parameters:
spaceIds
- list of space id for updatingdeadline
- processing should stop after this time. Null means "no deadline"- Returns:
- list of processed spaces
-
updateAllSpacePermissions
public int updateAllSpacePermissions(AtomicBoolean schedulingEnabled, Supplier<DenormalisedPermissionServiceState> spaceServiceStateSupplier) throws ExecutionException, InterruptedException Updates all space permissions. Space permissions are updated in batches, each batch is processed in its own separate transaction. As a result, if a server is restarted, some denormalised permissions will be created anyway.- 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
-
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-