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 Modifier and Type Field Description static int
DEFAULT_INITIAL_SPACE_PROCESSING_LIMIT
-
Constructor Summary
Constructors Constructor Description DenormalisedSpacePermissionsUpdater(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedSpacePermissionDao denormalisedSpacePermissionDao, SpacePermissionDao spacePermissionDao, DenormalisedSidManager denormalisedSidManager, org.springframework.transaction.PlatformTransactionManager platformTransactionManager, SpaceDaoInternal spaceDao)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
handleSpacePermissionChangeEvent(SpacePermissionChangeEvent spacePermissionChangeEvent)
void
init()
static void
setInitialSpaceProcessingLimit(int limit)
int
updateAllSpacePermissions(AtomicBoolean schedulingEnabled, Supplier<DenormalisedPermissionServiceState> spaceServiceStateSupplier)
Updates all space permissions.Set<Long>
updateSpacePermissions(Set<Long> spaceIds)
Calculates effective permissions for spaces and updates denormalised space permission records.Set<Long>
updateSpacePermissions(Set<Long> spaceIds, Long deadline)
Calculates effective permissions for spaces and updates denormalised space permission records.
-
-
-
Field Detail
-
DEFAULT_INITIAL_SPACE_PROCESSING_LIMIT
public static final int DEFAULT_INITIAL_SPACE_PROCESSING_LIMIT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DenormalisedSpacePermissionsUpdater
public DenormalisedSpacePermissionsUpdater(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedSpacePermissionDao denormalisedSpacePermissionDao, SpacePermissionDao spacePermissionDao, DenormalisedSidManager denormalisedSidManager, org.springframework.transaction.PlatformTransactionManager platformTransactionManager, SpaceDaoInternal spaceDao)
-
-
Method Detail
-
setInitialSpaceProcessingLimit
public static void setInitialSpaceProcessingLimit(int limit)
-
init
@PostConstruct public void init()
-
handleSpacePermissionChangeEvent
@EventListener public void handleSpacePermissionChangeEvent(SpacePermissionChangeEvent spacePermissionChangeEvent)
-
updateSpacePermissions
public Set<Long> updateSpacePermissions(Set<Long> spaceIds)
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
public Set<Long> updateSpacePermissions(Set<Long> spaceIds, Long deadline)
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
-
-