[workflow] Feature: allow user to retrieve the access link for the

workflow + show dest email for a workflow
This commit is contained in:
2022-09-29 22:05:29 +02:00
parent aa5094f196
commit 0609fdee14
5 changed files with 56 additions and 1 deletions

View File

@@ -27,6 +27,8 @@ class EntityWorkflowVoter extends Voter
public const SEE = 'CHILL_MAIN_WORKFLOW_SEE';
public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW';
private EntityWorkflowManager $manager;
private Security $security;
@@ -80,6 +82,19 @@ class EntityWorkflowVoter extends Voter
case self::DELETE:
return $subject->getStep() === 'initial';
case self::SHOW_ENTITY_LINK:
if ($subject->getStep() === 'initial') {
return false;
}
$currentStep = $subject->getCurrentStepChained();
if ($currentStep->isFinal()) {
return false;
}
return $currentStep->getPrevious()->getTransitionBy() === $this->security->getUser();
default:
throw new UnexpectedValueException("attribute {$attribute} not supported");
}
@@ -91,6 +106,7 @@ class EntityWorkflowVoter extends Voter
self::SEE,
self::CREATE,
self::DELETE,
self::SHOW_ENTITY_LINK,
];
}
}