mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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\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());
|
||||
|
@ -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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user