Remove usage of deprecated Role class

This commit is contained in:
2023-08-31 17:08:18 +02:00
parent 76142c1264
commit 7c58880139
33 changed files with 55 additions and 80 deletions

View File

@@ -116,7 +116,7 @@ class SingleTaskListType extends AbstractType
'centers' => $this->authorizationHelper
->getReachableCenters(
$this->tokenStorage->getToken()->getUser(),
new Role(TaskVoter::SHOW)
TaskVoter::SHOW
),
'required' => false,
'label' => 'Associated person',
@@ -160,7 +160,7 @@ class SingleTaskListType extends AbstractType
protected function getReachablesCenters()
{
$user = $this->tokenStorage->getToken()->getUser();
$role = new Role(TaskVoter::SHOW);
$role = TaskVoter::SHOW;
return $this->authorizationHelper->getReachableCenters($user, $role);
}
@@ -169,7 +169,7 @@ class SingleTaskListType extends AbstractType
{
$qb = $this->em->createQueryBuilder();
$user = $this->tokenStorage->getToken()->getUser();
$role = new Role(TaskVoter::SHOW);
$role = TaskVoter::SHOW;
$centers = $this->authorizationHelper->getReachableCenters($user, $role);
$qb->select('DISTINCT task.type AS type')
@@ -237,7 +237,7 @@ class SingleTaskListType extends AbstractType
{
$qb = $this->em->createQueryBuilder();
$user = $this->tokenStorage->getToken()->getUser();
$role = new Role(TaskVoter::SHOW);
$role = TaskVoter::SHOW;
$centers = $this->authorizationHelper->getReachableCenters($user, $role);
$qb->select('DISTINCT user')

View File

@@ -78,6 +78,6 @@ class SingleTaskType extends AbstractType
{
$resolver
->setRequired('role')
->setAllowedTypes('role', [Role::class, 'string']);
->setAllowedTypes('role', ['string']);
}
}

View File

@@ -159,7 +159,7 @@ class SingleTaskRepository extends EntityRepository
. '`setAuthorizationHelper`');
}
$role = new Role(TaskVoter::SHOW);
$role = TaskVoter::SHOW;
$qb->join('st.person', 'p');
$centers = $this->authorizationHelper

View File

@@ -168,7 +168,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface
foreach (
$this->authorizationHelper->getReachableCenters(
$this->security->getUser(),
new Role(ActivityVoter::SEE_DETAILS)
ActivityVoter::SEE_DETAILS
) as $center
) {
if (false === in_array($center, $centers, true)) {
@@ -181,7 +181,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface
// we loop over circles
$circles = $this->authorizationHelper->getReachableCircles(
$this->security->getUser(),
new Role(ActivityVoter::SEE_DETAILS),
ActivityVoter::SEE_DETAILS,
$center
);
$circleIds = [];
@@ -234,7 +234,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface
// we loop over circles
$circles = $this->authorizationHelper->getReachableCircles(
$this->security->getUser(),
new Role(ActivityVoter::SEE_DETAILS),
ActivityVoter::SEE_DETAILS,
$personArg->getCenter()
);