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:
2024-06-26 13:45:15 +02:00
parent 4607c36b57
commit c06e76a0ee
18 changed files with 456 additions and 88 deletions

View File

@@ -12,12 +12,13 @@ declare(strict_types=1);
namespace Chill\DocStoreBundle\Security\Authorization;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
interface StoredObjectVoterInterface {
public function supports(string $attribute, StoredObject $subject): bool;
public function supports(StoredObjectRoleEnum $attribute, StoredObject $subject): bool;
public function voteOnAttribute(string $attribute, StoredObject $subject, TokenInterface $token): bool;
public function voteOnAttribute(StoredObjectRoleEnum $attribute, StoredObject $subject, TokenInterface $token): bool;
}