Refactorize StoredObjectVoter.php

The StoredObjectVoter.php has been refactorized to handle context-specific voters.\
This way we can check if the context-specific voter should handle the authorization or not.\
If not, there is a simple fallback to check on the USER_ROLE.
This commit is contained in:
2024-06-14 17:22:27 +02:00
parent 2d09efb2e0
commit a0fead48e1
2 changed files with 35 additions and 7 deletions

View File

@@ -0,0 +1,14 @@
services:
_defaults:
autowire: true
autoconfigure: true
Chill\DocStoreBundle\Security\Authorization\StoredObjectVoter:
arguments:
$storedObjectVoters:
# context specific voters
- '@accompanying_course_document_voter'
tags:
- { name: security.voter }
accompanying_course_document_voter:
class: Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter