mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fixes quick for accompanying cours edocument voter
This commit is contained in:
parent
388db459bf
commit
62f8d2c01d
@ -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();
|
||||
|
@ -25,7 +25,7 @@
|
||||
aria-expanded="false">
|
||||
|
||||
{{ 'Welcome' | trans }}<br/>
|
||||
|
||||
|
||||
<b>
|
||||
{{ 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' %}
|
||||
<a class="dropdown-item list-group-item bg-dark text-white"
|
||||
href="{{ path('admin_user', {'_switch_user': '_exit'}) }}">
|
||||
<a class="dropdown-item list-group-item bg-dark text-white"
|
||||
href="{{ path('chill_crud_admin_user_index', {'_switch_user': '_exit'}) }}">
|
||||
{{ 'Exit impersonation'|trans }}
|
||||
{% else %}
|
||||
<a class="dropdown-item list-group-item bg-dark text-white"
|
||||
|
Loading…
x
Reference in New Issue
Block a user