mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
voters adjusted
This commit is contained in:
parent
26a13ae6df
commit
210c8b8b97
@ -91,6 +91,11 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif ($subject->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
} 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())) {
|
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getAccompanyingPeriod())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,14 @@ class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements Prov
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subject instanceof AccompanyingCourseDocument) {
|
||||||
|
if (AccompanyingPeriod::STEP_CLOSED === $subject->getCourse()->getStep()) {
|
||||||
|
if (\in_array($attribute, [self::UPDATE, self::CREATE, self::DELETE])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
|
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,13 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($subject instanceof AccompanyingPeriod) {
|
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()) {
|
if (AccompanyingPeriod::STEP_DRAFT === $subject->getStep()) {
|
||||||
// only creator can see, edit, delete, etc.
|
// only creator can see, edit, delete, etc.
|
||||||
if ($subject->getCreatedBy() === $token->getUser()
|
if ($subject->getCreatedBy() === $token->getUser()
|
||||||
@ -77,13 +84,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRole
|
|||||||
|
|
||||||
return false;
|
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 confidential, only the referent can see it
|
||||||
if ($subject->isConfidential()) {
|
if ($subject->isConfidential()) {
|
||||||
return $token->getUser() === $subject->getUser();
|
return $token->getUser() === $subject->getUser();
|
||||||
|
@ -112,6 +112,12 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy
|
|||||||
if (!$this->accessDecisionManager->decide($token, [AccompanyingPeriodVoter::SEE], $period)) {
|
if (!$this->accessDecisionManager->decide($token, [AccompanyingPeriodVoter::SEE], $period)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AccompanyingPeriod::STEP_CLOSED === $subject->getCourse()->getStep()) {
|
||||||
|
if (\in_array($attribute, [self::UPDATE, self::CREATE_COURSE, self::DELETE])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user