diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php index 8354e63e7..944a27b27 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php @@ -7,6 +7,7 @@ use Chill\MainBundle\Security\Authorization\AbstractChillVoter; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\Security\ProvideRoleHierarchyInterface; use Chill\MainBundle\Entity\User; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; use Psr\Log\LoggerInterface; @@ -57,30 +58,23 @@ class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements Prov self::DELETE ]; } - + protected function supports($attribute, $subject) { - if (\in_array($attribute, $this->getRoles()) && $subject instanceof AccompanyingCourseDocument) { + + if (\in_array($attribute, $this->getRoles())) { return true; } - - //if ($subject instanceof AccompanyingPeriod && $attribute === self::CREATE) { - return true; - //} - + return false; } - protected function isGranted($attribute, $report, $user = null) + protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { - if (! $user instanceof User){ - return false; - } - // TODO - // return $this->helper->userHasAccess($user, $report, $attribute); return true; } + public function getRolesWithoutScope() { return array(); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Menu/user.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Menu/user.html.twig index c083bcb19..e42faeeb6 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Menu/user.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Menu/user.html.twig @@ -25,7 +25,7 @@ aria-expanded="false"> {{ 'Welcome' | trans }}
- + {{ app.user.username }} {{ render(controller('ChillMainBundle:UI:showNotificationUserCounter')) }} @@ -40,8 +40,8 @@ {% for menu in menus %} {% if is_granted('ROLE_PREVIOUS_ADMIN') and menu.name == 'Logout' %} - + {{ 'Exit impersonation'|trans }} {% else %}