changes to TaskVoter reinstated, mistake made in conflict resolvement

This commit is contained in:
2021-10-01 11:18:10 +02:00
12 changed files with 493 additions and 7 deletions

View File

@@ -146,18 +146,15 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy
// do regular check.
return $this->voter->voteOnAttribute($attribute, $subject, $token);
/*
if ($subject instanceof AbstractTask) {
$associated = $subject->getPerson() ?? $subject->getCourse();
if ($associated === null) {
throw new \LogicException("You should associate a person with task "
. "in order to check autorizations");
}
$person = $subject->getPerson();
} elseif ($subject instanceof Person) {
$associated = $subject;
} else {
// subject is null. We check that at least one center is reachable
$centers = $this->authorizationHelper->getReachableCenters($token->getUser(), new Role($attribute));
@@ -173,6 +170,8 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy
return false;
} elseif ($associated instanceof AccompanyingPeriod && !$this->accessDecisionManager->decide($token, [AccompanyingPeriodVoter::SEE], $associated)) {
return false;
} elseif ($associated instanceof AccompanyingPeriod && !$this->accessDecisionManager->decide($token, [AccompanyingPeriodVoter::SEE], $associated)) {
return false;
}
return $this->authorizationHelper->userHasAccess(
@@ -180,7 +179,7 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy
$subject,
$attribute
);
*/
}
public function getRoles()