fix access denied when updating a work

This commit is contained in:
Julien Fastré 2022-02-11 17:20:26 +01:00
parent e7d0c1cac6
commit 62c78e650f

View File

@ -58,6 +58,11 @@ class AccompanyingPeriodWorkVoter extends Voter
case self::SEE: case self::SEE:
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject->getAccompanyingPeriod()); return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject->getAccompanyingPeriod());
case self::CREATE:
case self::UPDATE:
return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod());
default: default:
throw new UnexpectedValueException("attribute {$attribute} is not supported"); throw new UnexpectedValueException("attribute {$attribute} is not supported");
} }
@ -79,6 +84,6 @@ class AccompanyingPeriodWorkVoter extends Voter
private function getRoles(): array private function getRoles(): array
{ {
return [self::SEE]; return [self::SEE, self::CREATE, self::UPDATE];
} }
} }