mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Adjust logic to only allow on hold if user is allowed to apply a transition
This commit is contained in:
parent
8c5e94e295
commit
46b31ae1ea
@ -32,11 +32,21 @@ class WorkflowOnHoldController extends AbstractController
|
|||||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
||||||
|
|
||||||
$enabledTransitions = $workflow->getEnabledTransitions($entityWorkflow);
|
$enabledTransitions = $workflow->getEnabledTransitions($entityWorkflow);
|
||||||
$usersInvolved = $entityWorkflow->getUsersInvolved();
|
if (\count($enabledTransitions) === 0) {
|
||||||
|
throw $this->createAccessDeniedException('No transitions are available for the current workflow state.');
|
||||||
|
}
|
||||||
|
|
||||||
/* if (count($enabledTransitions) > 0) {
|
$isTransitionAllowed = false;
|
||||||
|
foreach ($enabledTransitions as $transition) {
|
||||||
|
if ($workflow->can($entityWorkflow, $transition->getName())) {
|
||||||
|
$isTransitionAllowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}*/
|
if (!$isTransitionAllowed) {
|
||||||
|
throw $this->createAccessDeniedException('You are not allowed to apply any transitions to this workflow, therefore you cannot put it on hold.');
|
||||||
|
}
|
||||||
|
|
||||||
$stepHold = new EntityWorkflowStepHold($currentStep, $currentUser);
|
$stepHold = new EntityWorkflowStepHold($currentStep, $currentUser);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user