mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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
e015f71bb0
commit
e0828b1f0f
@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\DependencyInjection;
|
|||||||
use Chill\DocStoreBundle\Controller\StoredObjectApiController;
|
use Chill\DocStoreBundle\Controller\StoredObjectApiController;
|
||||||
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
||||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||||
|
use ChillDocStoreBundle\Security\Authorization\StoredObjectVoterInterface;
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||||
@ -35,6 +36,8 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf
|
|||||||
|
|
||||||
$container->setParameter('chill_doc_store', $config);
|
$container->setParameter('chill_doc_store', $config);
|
||||||
|
|
||||||
|
$container->registerForAutoconfiguration(StoredObjectVoterInterface::class)->addTag('stored_object_voter');
|
||||||
|
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||||
$loader->load('services.yaml');
|
$loader->load('services.yaml');
|
||||||
$loader->load('services/controller.yaml');
|
$loader->load('services/controller.yaml');
|
||||||
|
@ -4,11 +4,10 @@ services:
|
|||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
Chill\DocStoreBundle\Security\Authorization\StoredObjectVoter:
|
Chill\DocStoreBundle\Security\Authorization\StoredObjectVoter:
|
||||||
arguments:
|
arguments:
|
||||||
$storedObjectVoters:
|
$storedObjectVoters: !tagged_iterator stored_object_voter
|
||||||
# context specific voters
|
|
||||||
- '@accompanying_course_document_voter'
|
|
||||||
tags:
|
tags:
|
||||||
- { name: security.voter }
|
- { name: security.voter }
|
||||||
|
|
||||||
accompanying_course_document_voter:
|
Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter:
|
||||||
class: Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter
|
tags:
|
||||||
|
- { name: security.voter }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user