From 05e9f118d725fa25bffa0a17ae7815b0ae71d048 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Feb 2022 17:15:38 +0100 Subject: [PATCH] Corrections voter + entity property intensity, not emergency --- .../ChillPersonBundle/Entity/AccompanyingPeriod.php | 4 ++-- .../Security/Authorization/AccompanyingPeriodVoter.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 8298161b9..1eace991d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -183,7 +183,7 @@ class AccompanyingPeriod implements /** * @ORM\Column(type="boolean", options={"default": false}) - * @Groups({"read", "docgen:read"}) + * @Groups({"read", "write", "docgen:read"}) */ private bool $emergency = false; @@ -198,7 +198,7 @@ class AccompanyingPeriod implements /** * @var string * @ORM\Column(type="string", nullable=true) - * @Groups({"read", "write"}) + * @Groups({"read"}) * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private $intensity = self::INTENSITY_OCCASIONAL; diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php index 117a59876..2033076f5 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php @@ -33,7 +33,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH self::DELETE, self::FULL, self::TOGGLE_CONFIDENTIAL_ALL, - self::TOGGLE_URGENCY + self::TOGGLE_INTENSITY ]; public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE'; @@ -66,7 +66,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH * Right to toggle urgency of parcours. */ - public const TOGGLE_URGENCY = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_URGENCY'; + public const TOGGLE_INTENSITY = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_INTENSITY'; private Security $security; @@ -138,12 +138,12 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH return $this->voterHelper->voteOnAttribute(self::TOGGLE_CONFIDENTIAL_ALL, $subject, $token); } - if (self::TOGGLE_URGENCY === $attribute) { + if (self::TOGGLE_INTENSITY === $attribute) { if ($subject->getUser() === $token->getUser()) { return true; } - return $this->voterHelper->voteOnAttribute(self::TOGGLE_CONFIDENTIAL_ALL, $subject, $token); + return false; } // if confidential, only the referent can see it