mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
fix sf4 deprecated: improve relying AuthorizationHelper service
This commit is contained in:
parent
61c11c3eee
commit
c5b1caefb6
@ -5,6 +5,7 @@ namespace Chill\DocStoreBundle\Controller;
|
|||||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||||
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
||||||
use Chill\DocStoreBundle\Repository\DocumentRepository;
|
use Chill\DocStoreBundle\Repository\DocumentRepository;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
@ -36,16 +37,23 @@ class DocumentPersonController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected $eventDispatcher;
|
protected $eventDispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AuthorizationHelper
|
||||||
|
*/
|
||||||
|
protected $authorizationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocumentPersonController constructor.
|
* DocumentPersonController constructor.
|
||||||
*
|
|
||||||
* @param TranslatorInterface $translator
|
* @param TranslatorInterface $translator
|
||||||
* @param EventDispatcherInterface $eventDispatcher
|
* @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->translator = $translator;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +69,7 @@ class DocumentPersonController extends Controller
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||||
|
|
||||||
$reachableScopes = $this->get('chill.main.security.authorization.helper')
|
$reachableScopes = $this->authorizationHelper
|
||||||
->getReachableScopes(
|
->getReachableScopes(
|
||||||
$this->getUser(), new Role(PersonDocumentVoter::SEE),
|
$this->getUser(), new Role(PersonDocumentVoter::SEE),
|
||||||
$person->getCenter());
|
$person->getCenter());
|
||||||
|
@ -5,5 +5,7 @@ services:
|
|||||||
|
|
||||||
Chill\DocStoreBundle\Controller\DocumentPersonController:
|
Chill\DocStoreBundle\Controller\DocumentPersonController:
|
||||||
autowire: true
|
autowire: true
|
||||||
|
public: true # TODO sf4, check if service could be public
|
||||||
arguments:
|
arguments:
|
||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
|
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user