voters adjusted

This commit is contained in:
2021-11-19 11:29:29 +01:00
parent fc8a766c25
commit f145d6c921
4 changed files with 27 additions and 7 deletions

View File

@@ -68,6 +68,13 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
}
if ($subject instanceof AccompanyingPeriod) {
if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) {
if (\in_array($attribute, [self::EDIT, self::DELETE])) {
return false;
}
}
if (AccompanyingPeriod::STEP_DRAFT === $subject->getStep()) {
// only creator can see, edit, delete, etc.
if ($subject->getCreatedBy() === $token->getUser()
@@ -77,13 +84,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
return false;
}
// if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) {
// if($this->security->isGranted(self::EDIT, $subject)) {
// return false;
// }
// }
// if confidential, only the referent can see it
if ($subject->isConfidential()) {
return $token->getUser() === $subject->getUser();