mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +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;
|
||||
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@ -44,14 +45,21 @@ class ActivityController extends Controller
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
|
||||
/**
|
||||
* ActivityController constructor.
|
||||
*
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param AuthorizationHelper $authorizationHelper
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher, AuthorizationHelper $authorizationHelper)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,7 +77,7 @@ class ActivityController extends Controller
|
||||
|
||||
$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'),
|
||||
$person->getCenter());
|
||||
|
||||
|
@ -2,4 +2,5 @@ services:
|
||||
Chill\ActivityBundle\Controller\ActivityController:
|
||||
arguments:
|
||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
||||
tags: ['controller.service_arguments']
|
||||
|
Loading…
x
Reference in New Issue
Block a user