mirror of
https://github.com/keycloak/keycloak.git
synced 2025-12-21 06:20:05 -06:00
Ensure workflow is only restarted on events that match the activation condition
Closes #44399 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
This commit is contained in:
committed by
Pedro Igor
parent
6653b72f88
commit
cd350082f7
@@ -261,7 +261,7 @@ public class DefaultWorkflowProvider implements WorkflowProvider {
|
||||
// workflow is active for the resource, check if the provider wants to reset or deactivate it based on the event
|
||||
String executionId = scheduledStep.executionId();
|
||||
String resourceId = scheduledStep.resourceId();
|
||||
if (provider.reset(context)) {
|
||||
if (provider.restart(context)) {
|
||||
new DefaultWorkflowExecutionContext(session, workflow, event, scheduledStep).restart();
|
||||
} else if (provider.deactivate(context)) {
|
||||
log.debugf("Workflow '%s' cancelled for resource %s (execution id: %s)", workflow.getName(), resourceId, executionId);
|
||||
|
||||
@@ -47,12 +47,12 @@ final class EventBasedWorkflow {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean reset(WorkflowExecutionContext executionContext) throws WorkflowInvalidStateException {
|
||||
boolean restart(WorkflowExecutionContext executionContext) throws WorkflowInvalidStateException {
|
||||
WorkflowEvent event = executionContext.getEvent();
|
||||
if (event == null) {
|
||||
return false;
|
||||
}
|
||||
return supports(event.getResourceType()) && isCancelIfRunning() && validateResourceConditions(executionContext);
|
||||
return isCancelIfRunning() && activate(executionContext);
|
||||
}
|
||||
|
||||
public boolean validateResourceConditions(WorkflowExecutionContext context) {
|
||||
|
||||
Reference in New Issue
Block a user