mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Implement context-specific voters for all current entities that can be linked to a document
For reusability an AbstractStoredObjectVoter was created and a StoredObjectVoterInterface. A WorkflowDocumentService checks whether the StoredObject is involved in a workflow.
This commit is contained in:
@@ -13,19 +13,19 @@ class WorkflowDocumentService
|
||||
{
|
||||
}
|
||||
|
||||
public function getRelatedWorkflow($entity): ?EntityWorkflow
|
||||
public function notBlockedByWorkflow($entity): bool
|
||||
{
|
||||
return $this->repository->findByRelatedEntity(get_class($entity), $entity->getId());
|
||||
}
|
||||
/**
|
||||
* @var EntityWorkflow
|
||||
*/
|
||||
$workflow = $this->repository->findByRelatedEntity(get_class($entity), $entity->getId());
|
||||
|
||||
public function canApplyTransition(EntityWorkflow $entityWorkflow): bool
|
||||
{
|
||||
if ($entityWorkflow->isFinal()) {
|
||||
if ($workflow->isFinal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$currentUser = $this->security->getUser();
|
||||
if ($entityWorkflow->getCurrentStep()->getAllDestUser()->contains($currentUser)) {
|
||||
if ($workflow->getCurrentStep()->getAllDestUser()->contains($currentUser)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user