mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Toggle_emergency variable added to voter
This commit is contained in:
parent
41b0dd50bd
commit
7aad5be29f
@ -33,6 +33,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
self::DELETE,
|
||||
self::FULL,
|
||||
self::TOGGLE_CONFIDENTIAL_ALL,
|
||||
self::TOGGLE_URGENCY
|
||||
];
|
||||
|
||||
public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE';
|
||||
@ -61,6 +62,11 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
* Right to toggle confidentiality.
|
||||
*/
|
||||
public const TOGGLE_CONFIDENTIAL_ALL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL_ALL';
|
||||
/**
|
||||
* Right to toggle urgency of parcours.
|
||||
*/
|
||||
|
||||
public const TOGGLE_URGENCY = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_URGENCY';
|
||||
|
||||
private Security $security;
|
||||
|
||||
@ -132,6 +138,14 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
return $this->voterHelper->voteOnAttribute(self::TOGGLE_CONFIDENTIAL_ALL, $subject, $token);
|
||||
}
|
||||
|
||||
if (self::TOGGLE_URGENCY === $attribute) {
|
||||
if ($subject->getUser() === $token->getUser()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->voterHelper->voteOnAttribute(self::TOGGLE_CONFIDENTIAL_ALL, $subject, $token);
|
||||
}
|
||||
|
||||
// if confidential, only the referent can see it
|
||||
if ($subject->isConfidential()) {
|
||||
return $token->getUser() === $subject->getUser();
|
||||
|
Loading…
x
Reference in New Issue
Block a user