From b81c834b5e4664843fa75039d88da1b65dbf97fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 24 Nov 2021 15:14:06 +0000 Subject: [PATCH] check acl before showing button for creating activity in person/activity --- CHANGELOG.md | 2 ++ .../Resources/views/Activity/list.html.twig | 1 - .../Resources/views/Activity/listPerson.html.twig | 4 +++- .../Tests/Validator/Person/PersonHasCenterValidatorTest.php | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80eb4fd1e..8805ed944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ and this project adheres to * Use the user.label in accompanying course banner, instead of username; * fix: show validation message when closing accompanying course; * [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 ## Test releases diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index fef381527..7c75f5bf0 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -3,7 +3,6 @@ {% if activities|length == 0 %}

{{ "There isn't any activities."|trans }} -

{% else %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig index 830fecfb9..158bd0e1b 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/listPerson.html.twig @@ -36,12 +36,14 @@ {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %} + {% if is_granted('CHILL_ACTIVITY_CREATE', person) %} + {% endif %} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php index 5c101740e..6603ca795 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php @@ -54,6 +54,7 @@ class PersonHasCenterValidatorTest extends ConstraintValidatorTestCase ]); $prophecy = $this->prophesize(CenterResolverManagerInterface::class); + $prophecy->resolveCenters(Argument::type(Person::class), Argument::any())->will(function ($args) { $center = $args[0]->getCenter();