voter fixes

This commit is contained in:
2021-11-22 10:19:14 +01:00
parent 9e75c7e9b2
commit 2c74e268d3
5 changed files with 25 additions and 21 deletions

View File

@@ -91,11 +91,6 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
return false;
}
} elseif ($subject->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
if (AccompanyingPeriod::STEP_CLOSED === $subject->getAccompanyingPeriod->getStep()) {
if (\in_array($attribute, [self::UPDATE, self::CREATE, self::DELETE])) {
return false;
}
}
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getAccompanyingPeriod())) {
return false;
}
@@ -104,6 +99,14 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
}
}
if ($subject instanceof AccompanyingPeriod) {
if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) {
if (\in_array($attribute, [self::UPDATE, self::CREATE, self::DELETE])) {
return false;
}
}
}
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
}