From db15a3d53c3143bc159132f88b5fccba882b256b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 29 Oct 2021 16:26:19 +0200 Subject: [PATCH] adapta list of tasks for a person --- .../Menu/UserMenuBuilder.php | 27 +- .../Controller/SingleTaskController.php | 95 ++++-- .../DataFixtures/ORM/LoadTaskACL.php | 27 +- .../ChillTaskExtension.php | 9 +- .../ChillTaskBundle/Menu/MenuBuilder.php | 4 +- .../SingleTaskAclAwareRepository.php | 43 ++- .../SingleTaskAclAwareRepositoryInterface.php | 15 + .../AccompanyingCourse/list.html.twig | 20 +- .../views/SingleTask/Person/list.html.twig | 275 +++--------------- .../Security/Authorization/TaskVoter.php | 53 +--- 10 files changed, 224 insertions(+), 344 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php index 14e775234..7eb161a50 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php @@ -17,6 +17,7 @@ */ namespace Chill\CalendarBundle\Menu; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Chill\TaskBundle\Templating\UI\CountNotificationTask; @@ -72,17 +73,19 @@ class UserMenuBuilder implements LocalMenuBuilderInterface { $user = $this->tokenStorage->getToken()->getUser(); - if ($this->authorizationChecker->isGranted('ROLE_USER')){ - $menu->addChild("My calendar list", [ - 'route' => 'chill_calendar_calendar_list', - 'routeParameters' => [ - 'user_id' => $user->getId(), - ] - ]) - ->setExtras([ - 'order' => 9, - 'icon' => 'tasks' - ]); + if ($this->authorizationChecker->isGranted('ROLE_USER') + && $user instanceof User + ) { + $menu->addChild("My calendar list", [ + 'route' => 'chill_calendar_calendar_list', + 'routeParameters' => [ + 'user_id' => $user->getId(), + ] + ]) + ->setExtras([ + 'order' => 9, + 'icon' => 'tasks' + ]); } } @@ -90,5 +93,5 @@ class UserMenuBuilder implements LocalMenuBuilderInterface { return [ 'user' ]; } - + } diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 90ec16ec3..fe262318e 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -165,8 +165,8 @@ final class SingleTaskController extends AbstractController } if ($entityType === 'person') { - return $this->redirectToRoute('chill_task_singletask_list', [ - 'person_id' => $task->getPerson()->getId() + return $this->redirectToRoute('chill_task_singletask_by-person_list', [ + 'id' => $task->getPerson()->getId() ]); } elseif ($entityType === 'course') { return $this->redirectToRoute('chill_task_singletask_by-course_list', [ @@ -399,17 +399,16 @@ final class SingleTaskController extends AbstractController $this->addFlash('success', $this->translator ->trans("The task has been successfully removed.")); - if($task->getContext() instanceof Person){ + if ($task->getContext() instanceof Person) { return $this->redirect($this->generateUrl( - 'chill_task_singletask_list', - $request->query->get('list_params', [ - 'person_id' => $person->getId() - ]))); + 'chill_task_singletask_by-person_list', + [ 'id' => $task->getPerson()->getId() ] + )); } else { return $this->redirect($this->generateUrl( 'chill_task_singletask_by-course_list', - ['id' => $course->getId()] - )); + ['id' => $task->getCourse()->getId()] + )); } } } @@ -753,13 +752,14 @@ final class SingleTaskController extends AbstractController * "/{_locale}/task/single-task/by-course/{id}", * name="chill_task_singletask_by-course_list") */ - public function listCourseTasks( AccompanyingPeriod $course, FormFactoryInterface $formFactory, Request $request ): Response { + $this->denyAccessUnlessGranted(TaskVoter::SHOW, $course); + $filterOrder = $this->buildFilterOrder(); $flags = \array_merge( $filterOrder->getCheckboxData('status'), @@ -771,17 +771,22 @@ final class SingleTaskController extends AbstractController $flags ); $paginator = $this->paginatorFactory->create($nb); - $tasks = $this->singleTaskAclAwareRepository->findByCourse( - $course, - $filterOrder->getQueryString(), - $flags, - $paginator->getCurrentPageFirstItemNumber(), - $paginator->getItemsPerPage(), - [ - 'startDate' => 'DESC', - 'endDate' => 'DESC', - ] - ); + + if (0 < $nb) { + $tasks = $this->singleTaskAclAwareRepository->findByCourse( + $course, + $filterOrder->getQueryString(), + $flags, + $paginator->getCurrentPageFirstItemNumber(), + $paginator->getItemsPerPage(), + [ + 'startDate' => 'DESC', + 'endDate' => 'DESC', + ] + ); + } else { + $tasks = []; + } return $this->render( '@ChillTask/SingleTask/AccompanyingCourse/list.html.twig', @@ -793,4 +798,52 @@ final class SingleTaskController extends AbstractController ]); } + /** + * @Route( + * "/{_locale}/task/single-task/by-person/{id}", + * name="chill_task_singletask_by-person_list") + */ + public function listPersonTasks( + Person $person + ): Response { + + $this->denyAccessUnlessGranted(TaskVoter::SHOW, $person); + + $filterOrder = $this->buildFilterOrder(); + $flags = \array_merge( + $filterOrder->getCheckboxData('status'), + \array_map(fn ($i) => 'state_'.$i, $filterOrder->getCheckboxData('states')) + ); + $nb = $this->singleTaskAclAwareRepository->countByPerson( + $person, + $filterOrder->getQueryString(), + $flags + ); + $paginator = $this->paginatorFactory->create($nb); + + if (0 < $nb) { + $tasks = $this->singleTaskAclAwareRepository->findByPerson( + $person, + $filterOrder->getQueryString(), + $flags, + $paginator->getCurrentPageFirstItemNumber(), + $paginator->getItemsPerPage(), + [ + 'startDate' => 'DESC', + 'endDate' => 'DESC', + ] + ); + } else { + $tasks = []; + } + + return $this->render( + '@ChillTask/SingleTask/Person/list.html.twig', + [ + 'tasks' => $tasks, + 'person' => $person, + 'paginator' => $paginator, + 'filter_order' => $filterOrder + ]); + } } diff --git a/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php b/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php index 5af11f6a2..513d18ea8 100644 --- a/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php +++ b/src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php @@ -40,7 +40,7 @@ class LoadTaskACL extends AbstractFixture implements OrderedFixtureInterface return 16000; } - + public function load(ObjectManager $manager) { foreach (LoadPermissionsGroup::$refs as $permissionsGroupRef) { @@ -58,33 +58,38 @@ class LoadTaskACL extends AbstractFixture implements OrderedFixtureInterface case 'direction': if (in_array($scope->getName()['en'], array('administrative', 'social'))) { break 2; // we do not want any power on social or administrative - } + } break; } - + printf("Adding CHILL_TASK_TASK_UPDATE & CHILL_TASK_TASK_CREATE & Chill_TASK_TASK_DELETE permissions to %s " - . "permission group, scope '%s' \n", + . "permission group, scope '%s' \n", $permissionsGroup->getName(), $scope->getName()['en']); $roleScopeUpdate = (new RoleScope()) ->setRole(TaskVoter::UPDATE) ->setScope($scope); $permissionsGroup->addRoleScope($roleScopeUpdate); - $roleScopeCreate = (new RoleScope()) - ->setRole(TaskVoter::CREATE) + $roleScopeCreateP = (new RoleScope()) + ->setRole(TaskVoter::CREATE_PERSON) ->setScope($scope); - $permissionsGroup->addRoleScope($roleScopeCreate); + $permissionsGroup->addRoleScope($roleScopeCreateP); + $roleScopeCreateC = (new RoleScope()) + ->setRole(TaskVoter::CREATE_COURSE) + ->setScope($scope); + $permissionsGroup->addRoleScope($roleScopeCreateC); $roleScopeDelete = (new RoleScope()) ->setRole(TaskVoter::DELETE) ->setScope($scope); $permissionsGroup->addRoleScope($roleScopeDelete); - + $manager->persist($roleScopeUpdate); - $manager->persist($roleScopeCreate); + $manager->persist($roleScopeCreateP); + $manager->persist($roleScopeCreateC); $manager->persist($roleScopeDelete); } - + } - + $manager->flush(); } diff --git a/src/Bundle/ChillTaskBundle/DependencyInjection/ChillTaskExtension.php b/src/Bundle/ChillTaskBundle/DependencyInjection/ChillTaskExtension.php index 5ffbd38e7..ed2a36595 100644 --- a/src/Bundle/ChillTaskBundle/DependencyInjection/ChillTaskExtension.php +++ b/src/Bundle/ChillTaskBundle/DependencyInjection/ChillTaskExtension.php @@ -44,7 +44,7 @@ class ChillTaskExtension extends Extension implements PrependExtensionInterface $this->prependRoute($container); $this->prependWorkflows($container); } - + protected function prependRoute(ContainerBuilder $container) { //declare routes for task bundle @@ -56,17 +56,18 @@ class ChillTaskExtension extends Extension implements PrependExtensionInterface ) )); } - + protected function prependAuthorization(ContainerBuilder $container) { $container->prependExtensionConfig('security', array( 'role_hierarchy' => array( TaskVoter::UPDATE => [TaskVoter::SHOW], - TaskVoter::CREATE => [TaskVoter::SHOW] + TaskVoter::CREATE_COURSE => [TaskVoter::SHOW], + TaskVoter::CREATE_PERSON => [TaskVoter::SHOW], ) )); } - + protected function prependWorkflows(ContainerBuilder $container) { $container->prependExtensionConfig('framework', [ diff --git a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php index 53751de91..dfc95535b 100644 --- a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php +++ b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php @@ -76,9 +76,9 @@ class MenuBuilder implements LocalMenuBuilderInterface if ($this->authorizationChecker->isGranted(TaskVoter::SHOW, $person)) { $menu->addChild( $this->translator->trans('Tasks'), [ - 'route' => 'chill_task_singletask_list', + 'route' => 'chill_task_singletask_by-person_list', 'routeParameters' => - [ 'person_id' => $person->getId() ] + [ 'id' => $person->getId() ] ]) ->setExtra('order', 400); } diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index cd3f819f4..c97ea3549 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -5,6 +5,7 @@ namespace Chill\TaskBundle\Repository; use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface; use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher; use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\Person; use Chill\TaskBundle\Entity\SingleTask; use Chill\TaskBundle\Security\Authorization\TaskVoter; use Doctrine\ORM\EntityManagerInterface; @@ -78,6 +79,33 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository ->getQuery()->getSingleScalarResult(); } + public function findByPerson( + Person $person, + ?string $pattern = null, + ?array $flags = [], + ?int $start = 0, + ?int $limit = 50, + ?array $orderBy = [] + ): array { + $qb = $this->buildQueryByPerson($person, $pattern, $flags); + $qb = $this->addACL($qb, $person); + + return $this->getResult($qb, $start, $limit, $orderBy); + } + + public function countByPerson( + Person $person, + ?string $pattern = null, + ?array $flags = [] + ): int { + $qb = $this->buildQueryByPerson($person, $pattern, $flags); + + return $this + ->addACL($qb, $person) + ->select('COUNT(t)') + ->getQuery()->getSingleScalarResult(); + } + public function buildQueryByCourse( AccompanyingPeriod $course, ?string $pattern = null, @@ -91,6 +119,19 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository ; } + public function buildQueryByPerson( + Person $person, + ?string $pattern = null, + ?array $flags = [] + ): QueryBuilder + { + $qb = $this->buildBaseQuery($pattern, $flags); + + return $qb + ->andWhere($qb->expr()->eq('t.person', ':person')) + ->setParameter('person', $person); + } + public function buildQueryMyTasks( ?string $pattern = null, ?array $flags = [] @@ -123,7 +164,7 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository return $qb->getQuery()->getResult(); } - public function addACL( + private function addACL( QueryBuilder $qb, $entity ): QueryBuilder { diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php index 55c5f07ff..0c6f4fc57 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php @@ -3,6 +3,7 @@ namespace Chill\TaskBundle\Repository; use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\Person; interface SingleTaskAclAwareRepositoryInterface { @@ -25,4 +26,18 @@ interface SingleTaskAclAwareRepositoryInterface ?array $flags = [] ): int; + public function findByPerson( + Person $person, + ?string $pattern = null, + ?array $flags = [], + ?int $start = 0, + ?int $limit = 50, + ?array $orderBy = [] + ): array; + + public function countByPerson( + Person $person, + ?string $pattern = null, + ?array $flags = [] + ): int; } diff --git a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/AccompanyingCourse/list.html.twig b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/AccompanyingCourse/list.html.twig index 480ea705f..6622bca4f 100644 --- a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/AccompanyingCourse/list.html.twig +++ b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/AccompanyingCourse/list.html.twig @@ -21,15 +21,17 @@ {{ chill_pagination(paginator) }} - + {% if is_granted('CHILL_TASK_TASK_CREATE_FOR_COURSE', person) %} + + {% endif %} {% endblock %} diff --git a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/Person/list.html.twig b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/Person/list.html.twig index ac08cf1b0..ee236b644 100644 --- a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/Person/list.html.twig +++ b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/Person/list.html.twig @@ -1,251 +1,44 @@ -{% macro date_status(title, tasks, count, paginator, status, isSingleStatus, person, user) %} - {% if tasks|length > 0 %} -

{{ title|trans }}

+{% extends '@ChillPerson/Person/layout.html.twig' %} - - - {% for task in tasks %} - - - - - {% endfor %} - -
-
- {{ task.title }} -
+{% set activeRouteKey = '' %} - {% if person is null %} -
- {{ 'For person'|trans }} : - - {{ task.person}} - -
- {% endif %} +{% block title 'Tasks for {{ name }}'|trans({ '{{ name }}' : person|chill_entity_render_string }) %} -
- {{ task_workflow_metadata(task, 'definition.name')|trans }} -
+{% block personcontent %} +
-
- {% for place in workflow_marked_places(task) %} - {{ place|trans }} - {% endfor %} - {% if task.assignee is not null %} -
- {{ 'By'|trans }} : - {{ task.assignee.username }}
- {% endif %} -
+

{{ block('title') }}

- {% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %} -
-
    - {% if task.startDate is not null %} -
  • - - {{ task.startDate|format_date('medium') }} -
  • - {% endif %} - {% if task.warningDate is not null %} -
  • - - {{ task.warningDate|format_date('medium') }} -
  • - {% endif %} - {% if task.endDate is not null %} -
  • - - {{ task.endDate|format_date('medium') }} -
  • - {% endif %} -
-
- {% endif %} + {{ filter_order|chill_render_filter_order_helper }} -
-
    - {% if workflow_transitions(task)|length > 0 %} -
  • -
    - - -
    -
  • - {% endif %} + {% if tasks|length == 0 %} +

    {{ 'Any tasks'|trans }}

    + {% else %} +
    + {% for task in tasks %} + {% include 'ChillTaskBundle:SingleTask/List:index_item.html.twig' with { 'showContext' : false } %} + {% endfor %} +
    + {% endif %} -
  • - -
  • + {{ chill_pagination(paginator) }} - {% if is_granted('CHILL_TASK_TASK_UPDATE', task) %} -
  • - -
  • - {% endif %} + {% if is_granted('CHILL_TASK_TASK_CREATE_FOR_PERSON', person) %} + + {% endif %} - {% if is_granted('CHILL_TASK_TASK_DELETE', task) %} -
  • - -
  • - {% endif %} -
-
+ +{% endblock %} - {% if isSingleStatus %} - {% if tasks|length < paginator.getTotalItems %} - {{ chill_pagination(paginator) }} - {% endif %} - - - - {% else %} - - {% endif %} - - {% endif %} -{% endmacro %} - -{% import _self as helper %} - -

{{ app.request.query.get('title', null)|escape('html')|default('Task list'|trans) }}

- -{% if false == app.request.query.boolean('hide_form', false) %} -

{{ 'Filter the tasks'|trans }}

- {{ form_start(form) }} - {{ form_row(form.user_id) }} - - {% if form.status is defined %} - {{ form_row(form.status) }} - {% endif %} - - {% if form.types is defined %} - {{ form_row(form.types) }} - {% endif %} - - {% if form.person_id is defined %} - {{ form_row(form.person_id) }} - {% endif %} - - {% if form.center_id is defined %} - {{ form_row(form.center_id) }} - {% endif %} - - - - {{ form_end(form)}} -{% endif %} - -{% if tasks_count == 0 %} -

{{ "There is no tasks."|trans }}

- {% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %} - - {% endif %} -{% else %} - - {% if false == app.request.query.boolean('hide_form', false) %} -

{{ 'Tasks'|trans }}

- {% endif %} - - {# TODO reimplement right to create task. #} - {# {% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %} #} - - {# {% endif %} #} - - {% if single_task_ended_tasks is defined %} - {{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }} - {% endif %} - - {% if single_task_warning_tasks is defined %} - {{ helper.date_status('Tasks with warning deadline reached', single_task_warning_tasks, single_task_warning_count, single_task_warning_paginator, 'warning', isSingleStatus, person) }} - {% endif %} - - {% if single_task_current_tasks is defined %} - {{ helper.date_status('Current tasks', single_task_current_tasks, single_task_current_count, single_task_current_paginator, 'current', isSingleStatus, person) }} - {% endif %} - - {% if single_task_not_started_tasks is defined %} - {{ helper.date_status('Tasks not started', single_task_not_started_tasks, single_task_not_started_count, single_task_not_started_paginator, 'not_started', isSingleStatus, person) }} - {% endif %} - - {% if single_task_closed_tasks is defined %} - {{ helper.date_status('Closed tasks', single_task_closed_tasks, single_task_closed_count, single_task_closed_paginator, 'closed', isSingleStatus, person) }} - {% endif %} - - {% if isSingleStatus == false %} - - {% endif %} - -{% endif %} +{% block css %} + {{ encore_entry_link_tags('page_task_list') }} +{% endblock %} +{% block js %} + {{ encore_entry_script_tags('page_task_list') }} +{% endblock %} diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php index ca77171cb..39d9eef32 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php @@ -41,16 +41,18 @@ use Chill\TaskBundle\Security\Authorization\AuthorizationEvent; final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - const CREATE = 'CHILL_TASK_TASK_CREATE'; - const UPDATE = 'CHILL_TASK_TASK_UPDATE'; - const SHOW = 'CHILL_TASK_TASK_SHOW'; + const CREATE_COURSE = 'CHILL_TASK_TASK_CREATE_FOR_COURSE'; + const CREATE_PERSON = 'CHILL_TASK_TASK_CREATE_FOR_PERSON'; const DELETE = 'CHILL_TASK_TASK_DELETE'; + const SHOW = 'CHILL_TASK_TASK_SHOW'; + const UPDATE = 'CHILL_TASK_TASK_UPDATE'; const ROLES = [ - self::CREATE, - self::UPDATE, + self::CREATE_COURSE, + self::CREATE_PERSON, + self::DELETE, self::SHOW, - self::DELETE + self::UPDATE, ]; protected AuthorizationHelper $authorizationHelper; @@ -84,8 +86,8 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy $this->voter = $voterFactory ->generate(AbstractTask::class) ->addCheckFor(AbstractTask::class, self::ROLES) - ->addCheckFor(Person::class, [self::SHOW, self::CREATE]) - ->addCheckFor(AccompanyingPeriod::class, [self::SHOW, self::CREATE]) + ->addCheckFor(Person::class, [self::SHOW, self::CREATE_PERSON]) + ->addCheckFor(AccompanyingPeriod::class, [self::SHOW, self::CREATE_COURSE]) ->addCheckFor(null, [self::SHOW]) ->build() ; @@ -147,41 +149,6 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy // do regular check. return $this->voter->voteOnAttribute($attribute, $subject, $token); - - - if ($subject instanceof AbstractTask) { - $associated = $subject->getPerson() ?? $subject->getCourse(); - if ($associated === null) { - throw new \LogicException("You should associate a person with task " - . "in order to check autorizations"); - } - $person = $subject->getPerson(); - } elseif ($subject instanceof Person) { - // subject is null. We check that at least one center is reachable - $centers = $this->authorizationHelper->getReachableCenters($token->getUser(), new Role($attribute)); - - return count($centers) > 0; - } - - if (!$this->accessDecisionManager->decide($token, [PersonVoter::SEE], $person)) { - return false; - } - $center = $this->centerResolverDispatcher->resolveCenter($subject); - - if (NULL === $center) { - return false; - } elseif ($associated instanceof AccompanyingPeriod && !$this->accessDecisionManager->decide($token, [AccompanyingPeriodVoter::SEE], $associated)) { - return false; - } elseif ($associated instanceof AccompanyingPeriod && !$this->accessDecisionManager->decide($token, [AccompanyingPeriodVoter::SEE], $associated)) { - return false; - } - - return $this->authorizationHelper->userHasAccess( - $token->getUser(), - $subject, - $attribute - ); - } public function getRoles()