diff --git a/Controller/DocumentPersonController.php b/Controller/DocumentPersonController.php index f6f074610..688977de8 100644 --- a/Controller/DocumentPersonController.php +++ b/Controller/DocumentPersonController.php @@ -5,6 +5,7 @@ namespace Chill\DocStoreBundle\Controller; use Chill\DocStoreBundle\Entity\PersonDocument; use Chill\DocStoreBundle\Form\PersonDocumentType; use Chill\DocStoreBundle\Repository\DocumentRepository; +use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Privacy\PrivacyEvent; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -36,16 +37,23 @@ class DocumentPersonController extends Controller */ protected $eventDispatcher; + /** + * @var AuthorizationHelper + */ + protected $authorizationHelper; + /** * DocumentPersonController constructor. - * + * @param TranslatorInterface $translator * @param EventDispatcherInterface $eventDispatcher + * @param AuthorizationHelper $authorizationHelper */ - public function __construct(TranslatorInterface $translator, EventDispatcherInterface $eventDispatcher) + public function __construct(TranslatorInterface $translator, EventDispatcherInterface $eventDispatcher, AuthorizationHelper $authorizationHelper) { $this->translator = $translator; $this->eventDispatcher = $eventDispatcher; + $this->authorizationHelper = $authorizationHelper; } /** @@ -61,7 +69,7 @@ class DocumentPersonController extends Controller $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); - $reachableScopes = $this->get('chill.main.security.authorization.helper') + $reachableScopes = $this->authorizationHelper ->getReachableScopes( $this->getUser(), new Role(PersonDocumentVoter::SEE), $person->getCenter()); diff --git a/Resources/config/services/controller.yml b/Resources/config/services/controller.yml index 0a2798508..ed2c55410 100644 --- a/Resources/config/services/controller.yml +++ b/Resources/config/services/controller.yml @@ -5,5 +5,7 @@ services: Chill\DocStoreBundle\Controller\DocumentPersonController: autowire: true + public: true # TODO sf4, check if service could be public arguments: $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' + $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'