Merge branch 'bugfix/accompanying-period-filter-list-by-person-using-acl' into 'master'

List for accompanying course for a person: filter using acl

See merge request Chill-Projet/chill-bundles!235
This commit is contained in:
Julien Fastré 2021-11-24 15:55:45 +00:00
commit 8a0d16dc53
2 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,7 @@ and this project adheres to
* [thirdparty] link from modal to thirdparty detail page fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/228)
* [activity] remove the "plus" button in activity list
* [activity] check ACL on activity list in person context
* [list for accompanying course in person] filter list using ACL
## Test releases

View File

@ -213,9 +213,14 @@ class AccompanyingPeriodController extends AbstractController
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$accompanyingPeriods = $this->accompanyingPeriodACLAwareRepository
$accompanyingPeriodsRaw = $this->accompanyingPeriodACLAwareRepository
->findByPerson($person, AccompanyingPeriodVoter::SEE);
// filter visible or not visible
$accompanyingPeriods = array_filter($accompanyingPeriodsRaw, function (AccompanyingPeriod $ap) {
return $this->isGranted(AccompanyingPeriodVoter::SEE, $ap);
});
return $this->render('@ChillPerson/AccompanyingPeriod/list.html.twig', [
'accompanying_periods' => $accompanyingPeriods,
'person' => $person,