mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Use service tags to inject all voters into StoredObjectVoter.php
Instead of manually injecting services into StoredObjectVoter\ config is added to automatically tag each service that implements\ StoredObjectVoterInterface.php
This commit is contained in:
parent
830dace1ba
commit
062afd6695
@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\DependencyInjection;
|
||||
use Chill\DocStoreBundle\Controller\StoredObjectApiController;
|
||||
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
use ChillDocStoreBundle\Security\Authorization\StoredObjectVoterInterface;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
@ -35,6 +36,8 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf
|
||||
|
||||
$container->setParameter('chill_doc_store', $config);
|
||||
|
||||
$container->registerForAutoconfiguration(StoredObjectVoterInterface::class)->addTag('stored_object_voter');
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||
$loader->load('services.yaml');
|
||||
$loader->load('services/controller.yaml');
|
||||
|
@ -4,11 +4,10 @@ services:
|
||||
autoconfigure: true
|
||||
Chill\DocStoreBundle\Security\Authorization\StoredObjectVoter:
|
||||
arguments:
|
||||
$storedObjectVoters:
|
||||
# context specific voters
|
||||
- '@accompanying_course_document_voter'
|
||||
$storedObjectVoters: !tagged_iterator stored_object_voter
|
||||
tags:
|
||||
- { name: security.voter }
|
||||
|
||||
accompanying_course_document_voter:
|
||||
class: Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter
|
||||
Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter:
|
||||
tags:
|
||||
- { name: security.voter }
|
||||
|
Loading…
x
Reference in New Issue
Block a user