From cd9ce1b458dc864a26ebb9297863314f2ed1451d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 24 Nov 2021 11:59:11 +0100 Subject: [PATCH 1/4] link to thirdparty resume page fixed --- .../Resources/public/vuejs/OnTheFly/components/OnTheFly.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue index 237166e62..d64ae274e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -189,7 +189,7 @@ export default { // TODO i18n return `/fr/person/${id}/general`; } else if (type === 'thirdparty') { - return `/fr/thirdparty/thirdparty/${id}/show`; + return `/fr/3party/3party/${id}/view`; } } } From 41f0578966266232838ec310fecc9176eba3d800 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 24 Nov 2021 12:01:57 +0100 Subject: [PATCH 2/4] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4acb29efc..80eb4fd1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ 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) ## Test releases From a2681a02f9e6e925c123a80930add8800e23f223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 24 Nov 2021 14:20:17 +0000 Subject: [PATCH 3/4] remove deprecation on PersonHasCenterValidator and fix tests --- phpstan-deprecations.neon | 8 -------- .../Person/PersonHasCenterValidatorTest.php | 16 +++++++++++++--- .../Person/PersonHasCenterValidator.php | 10 +++++----- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index bf1ec095e..6f9f19956 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -1330,14 +1330,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php - - - message: - """ - #^Parameter \\$centerResolverDispatcher of method Chill\\\\PersonBundle\\\\Validator\\\\Constraints\\\\Person\\\\PersonHasCenterValidator\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: - Use CenterResolverManager and its interface CenterResolverManagerInterface$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php - message: diff --git a/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php index 5d1bbeb9e..5c101740e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Validator/Person/PersonHasCenterValidatorTest.php @@ -12,10 +12,11 @@ declare(strict_types=1); namespace Validator\Person; use Chill\MainBundle\Entity\Center; -use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; +use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter; use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenterValidator; +use Prophecy\Argument; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; @@ -52,9 +53,18 @@ class PersonHasCenterValidatorTest extends ConstraintValidatorTestCase ], ]); - $centerResolverDispatcher = $this->createMock(CenterResolverDispatcherInterface::class); + $prophecy = $this->prophesize(CenterResolverManagerInterface::class); + $prophecy->resolveCenters(Argument::type(Person::class), Argument::any())->will(function ($args) { + $center = $args[0]->getCenter(); - return new PersonHasCenterValidator($parameterBag, $centerResolverDispatcher); + if ($center instanceof Center) { + return [$center]; + } + + return []; + }); + + return new PersonHasCenterValidator($parameterBag, $prophecy->reveal()); } protected function getConstraint() diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php index 7612cec8c..967b5672f 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Validator\Constraints\Person; -use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; +use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\PersonBundle\Entity\Person; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Validator\Constraint; @@ -22,12 +22,12 @@ class PersonHasCenterValidator extends ConstraintValidator { private bool $centerRequired; - private CenterResolverDispatcherInterface $centerResolverDispatcher; + private CenterResolverManagerInterface $centerResolverManager; - public function __construct(ParameterBagInterface $parameterBag, CenterResolverDispatcherInterface $centerResolverDispatcher) + public function __construct(ParameterBagInterface $parameterBag, CenterResolverManagerInterface $centerResolverManager) { $this->centerRequired = $parameterBag->get('chill_person')['validation']['center_required']; - $this->centerResolverDispatcher = $centerResolverDispatcher; + $this->centerResolverManager = $centerResolverManager; } public function validate($person, Constraint $constraint) @@ -40,7 +40,7 @@ class PersonHasCenterValidator extends ConstraintValidator return; } - if (null === $this->centerResolverDispatcher->resolveCenter($person)) { + if ([] === $this->centerResolverManager->resolveCenters($person)) { $this ->context ->buildViolation($constraint->message) 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 4/4] 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();