mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 19:43:49 +00:00
Refactor workflow handlers and update comments
Changes include class refactoring for Workflow handlers, using `readonly` and better indentation in constructors for better readability. In addition, outdated comments are removed. Also, entity workflow handlers now implement the EntityWorkflowHandlerInterface type for better type safety.
This commit is contained in:
@@ -12,13 +12,14 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
||||
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
|
||||
class WorkflowEntityDeletionVoter extends Voter
|
||||
{
|
||||
/**
|
||||
* @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers
|
||||
* @param EntityWorkflowHandlerInterface[] $handlers
|
||||
*/
|
||||
public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) {}
|
||||
|
||||
@@ -30,7 +31,7 @@ class WorkflowEntityDeletionVoter extends Voter
|
||||
|
||||
foreach ($this->handlers as $handler) {
|
||||
if ($handler->isObjectSupported($subject)
|
||||
&& \in_array($attribute, $handler->getDeletionRoles($subject), true)) {
|
||||
&& \in_array($attribute, $handler->getDeletionRoles(), true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user