mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 13:33:48 +00:00
wip.. EVENT_SEE and _CREATE works in twig test, not in php test
This commit is contained in:
@@ -87,18 +87,15 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
|
||||
}
|
||||
|
||||
if ($subject instanceof Event) {
|
||||
if ($subject->getId() === null) {
|
||||
throw new \LogicException("You should associate a person with event "
|
||||
. "in order to check autorizations");
|
||||
}
|
||||
$person = $subject->getId(); // liaison event --> person
|
||||
|
||||
return $this->authorizationHelper->userHasAccess($token->getUser(), $subject, $attribute);
|
||||
|
||||
} elseif ($subject instanceof Person) {
|
||||
$person = $subject;
|
||||
|
||||
return $this->authorizationHelper->userHasAccess($token->getUser(), $subject, $attribute);
|
||||
|
||||
} else {
|
||||
// subject is null. We check that at least one center is reachable
|
||||
$centers = $this->authorizationHelper->getReachableCenters($token->getUser(), new Role($attribute));
|
||||
$centers = $this->authorizationHelper
|
||||
->getReachableCenters($token->getUser(), new Role($attribute));
|
||||
|
||||
return count($centers) > 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user