mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
[workflow] Feature: allow user to retrieve the access link for the
workflow + show dest email for a workflow
This commit is contained in:
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user