mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
Remove usage of deprecated Role class
This commit is contained in:
@@ -189,7 +189,7 @@ class EventController extends AbstractController
|
||||
|
||||
$reachablesCircles = $this->authorizationHelper->getReachableCircles(
|
||||
$this->getUser(),
|
||||
new Role(EventVoter::SEE),
|
||||
EventVoter::SEE,
|
||||
$person->getCenter()
|
||||
);
|
||||
|
||||
@@ -274,7 +274,7 @@ class EventController extends AbstractController
|
||||
*/
|
||||
public function newPickCenterAction()
|
||||
{
|
||||
$role = new Role('CHILL_EVENT_CREATE');
|
||||
$role = 'CHILL_EVENT_CREATE';
|
||||
|
||||
/**
|
||||
* @var Center $centers
|
||||
@@ -404,7 +404,7 @@ class EventController extends AbstractController
|
||||
);
|
||||
|
||||
$builder->add('event_id', PickEventType::class, [
|
||||
'role' => new Role('CHILL_EVENT_CREATE'),
|
||||
'role' => 'CHILL_EVENT_CREATE',
|
||||
'centers' => $person->getCenter(),
|
||||
]);
|
||||
|
||||
@@ -451,7 +451,7 @@ class EventController extends AbstractController
|
||||
);
|
||||
|
||||
$builder->add('person_id', PickPersonType::class, [
|
||||
'role' => new Role('CHILL_EVENT_CREATE'),
|
||||
'role' => 'CHILL_EVENT_CREATE',
|
||||
'centers' => $event->getCenter(),
|
||||
]);
|
||||
|
||||
@@ -630,7 +630,7 @@ class EventController extends AbstractController
|
||||
$form = $this->createForm(EventType::class, $entity, [
|
||||
'method' => 'POST',
|
||||
'center' => $entity->getCenter(),
|
||||
'role' => new Role('CHILL_EVENT_CREATE'),
|
||||
'role' => 'CHILL_EVENT_CREATE',
|
||||
]);
|
||||
|
||||
$form->add('submit', SubmitType::class, ['label' => 'Create']);
|
||||
@@ -665,7 +665,7 @@ class EventController extends AbstractController
|
||||
'action' => $this->generateUrl('chill_event__event_update', ['event_id' => $entity->getId()]),
|
||||
'method' => 'PUT',
|
||||
'center' => $entity->getCenter(),
|
||||
'role' => new Role('CHILL_EVENT_CREATE'),
|
||||
'role' => 'CHILL_EVENT_CREATE',
|
||||
]);
|
||||
|
||||
$form->remove('center');
|
||||
|
@@ -59,7 +59,7 @@ class EventType extends AbstractType
|
||||
$resolver
|
||||
->setRequired(['center', 'role'])
|
||||
->setAllowedTypes('center', Center::class)
|
||||
->setAllowedTypes('role', Role::class);
|
||||
->setAllowedTypes('role', 'string');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -74,7 +74,7 @@ final class PickEventType extends AbstractType
|
||||
->setDefault('centers', null);
|
||||
$resolver
|
||||
->setDefined('role')
|
||||
->addAllowedTypes('role', [Role::class, 'null'])
|
||||
->addAllowedTypes('role', ['string', 'null'])
|
||||
->setDefault('role', null);
|
||||
|
||||
// add the default options
|
||||
|
@@ -119,7 +119,7 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
|
||||
|
||||
// subject is null. We check that at least one center is reachable
|
||||
$centers = $this->authorizationHelper
|
||||
->getReachableCenters($token->getUser(), new Role($attribute));
|
||||
->getReachableCenters($token->getUser(), $attribute);
|
||||
|
||||
return count($centers) > 0;
|
||||
|
||||
|
@@ -116,7 +116,7 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar
|
||||
|
||||
// subject is null. We check that at least one center is reachable
|
||||
$centers = $this->authorizationHelper
|
||||
->getReachableCenters($token->getUser(), new Role($attribute));
|
||||
->getReachableCenters($token->getUser(), $attribute);
|
||||
|
||||
return count($centers) > 0;
|
||||
|
||||
|
Reference in New Issue
Block a user