diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index e7243fba1..891a0f461 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -207,7 +207,11 @@ $workflow = $this->registry->get($accompanyingPeriod); */ public function getAccompanyingPeriodsByPerson(Person $person){ $accompanyingPeriods = $person->getAccompanyingPeriods(); - return $this->json(\array_values($accompanyingPeriods), Response::HTTP_OK, [], ['groups' => [ 'read']]); + $accompanyingPeriodsChecked = array_filter($accompanyingPeriods, + function(AccompanyingPeriod $period){ + return $this->isGranted(AccompanyingPeriodVoter::SEE, $period); + }); + return $this->json(\array_values($accompanyingPeriodsChecked), Response::HTTP_OK, [], ['groups' => [ 'read']]); } }