diff --git a/Menu/PersonMenuBuilder.php b/Menu/PersonMenuBuilder.php
index 7411d482b..0133409b8 100644
--- a/Menu/PersonMenuBuilder.php
+++ b/Menu/PersonMenuBuilder.php
@@ -48,17 +48,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
->setExtras([
'order' => 500
]);
- }
- ////
- else {
- dump('not see');
}
- if ($this->authorizationChecker->isGranted(EventVoter::CREATE, $person)) {
- dump('create');
- } else {
- dump('not create');
- }
- ////
}
public static function getMenuIds(): array
diff --git a/Resources/views/Event/listByPerson.html.twig b/Resources/views/Event/listByPerson.html.twig
index 82742674f..f0337b300 100644
--- a/Resources/views/Event/listByPerson.html.twig
+++ b/Resources/views/Event/listByPerson.html.twig
@@ -50,13 +50,6 @@
-
- {% if is_granted('CHILL_EVENT_SEE', participation.event) %}
- see {% else %} not see
- {% endif %}
- {% if is_granted('CHILL_EVENT_CREATE', participation.event) %}
- create {% else %} not create
- {% endif %}
-
{% if is_granted('CHILL_EVENT_SEE_DETAILS', participation.event) %}
{{ 'See'|trans }}
diff --git a/Security/Authorization/EventVoter.php b/Security/Authorization/EventVoter.php
index 0cdbabfb3..ead7917a7 100644
--- a/Security/Authorization/EventVoter.php
+++ b/Security/Authorization/EventVoter.php
@@ -1,6 +1,20 @@
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
namespace Chill\EventBundle\Security\Authorization;
@@ -9,16 +23,16 @@ use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Chill\EventBundle\Entity\Event;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Entity\User;
+use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Psr\Log\LoggerInterface;
-
/**
* Description of EventVoter
*
- * @author Julien Fastré
+ * @author Mathieu Jaumotte
* @author Champs Libres
*/
class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
@@ -93,23 +107,24 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
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));
return count($centers) > 0;
}
-
+
if (!$this->accessDecisionManager->decide($token, [PersonVoter::SEE], $person)) {
-
return false;
}
-
+
return $this->authorizationHelper->userHasAccess(
$token->getUser(),
$subject,
$attribute
);
+
}
|