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
5f8037433d
commit
3d1a12dc8b
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Controller;
|
namespace Chill\ActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@ -44,14 +45,21 @@ class ActivityController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected $eventDispatcher;
|
protected $eventDispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AuthorizationHelper
|
||||||
|
*/
|
||||||
|
protected $authorizationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActivityController constructor.
|
* ActivityController constructor.
|
||||||
*
|
*
|
||||||
* @param EventDispatcherInterface $eventDispatcher
|
* @param EventDispatcherInterface $eventDispatcher
|
||||||
|
* @param AuthorizationHelper $authorizationHelper
|
||||||
*/
|
*/
|
||||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
public function __construct(EventDispatcherInterface $eventDispatcher, AuthorizationHelper $authorizationHelper)
|
||||||
{
|
{
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,7 +77,7 @@ class ActivityController extends Controller
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
|
||||||
$reachableScopes = $this->get('chill.main.security.authorization.helper')
|
$reachableScopes = $this->authorizationHelper
|
||||||
->getReachableScopes($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
->getReachableScopes($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
||||||
$person->getCenter());
|
$person->getCenter());
|
||||||
|
|
||||||
|
@ -2,4 +2,5 @@ services:
|
|||||||
Chill\ActivityBundle\Controller\ActivityController:
|
Chill\ActivityBundle\Controller\ActivityController:
|
||||||
arguments:
|
arguments:
|
||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
|
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user