src/AppBundle/Security/SolicitudVoter.php
/**
     * Perform a single access check operation on a given attribute, subject and token.
     * It is safe to assume that $attribute and $subject already passed the "supports()" method check.
     *
     * @param string $attribute
     * @param mixed $subject
     * @param TokenInterface $token
     *
     * @return bool
     */
Perform a single access check operation on a given attribute, subject and token.
It is safe to assume that $attribute and $subject already passed the "supports()" method check.



@return bool
Perform a single access check operation on a given attribute subject and token . It is safe to assume that $attribute and $subject already passed the " supports () " method check . @return bool
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        $user = $token->getUser();
        if (!$user instanceof UserInterface) {
            return false;
        }
        if ($this->decisionManager->decide($token, ['ROLE_ADMIN'])) {
            return true;
        }
        switch ($attribute) {
            case self::CREATE:
                return $this->canCreate($user);
                break;
            case self::EDIT:
                return $this->canEdit($user);
                break;
            case self::DELETE:
                return $this->canDelete($user);
                break;
        }
        throw new \LogicException('This code should not be reached!');
    }
protected function voteOnAttribute ( $ attribute , $ subject , TokenInterface $ token ) { $ user = $ token -> getUser ( ) ; if ( ! $ user instanceof UserInterface ) { return false ; } if ( $ this -> decisionManager -> decide ( $ token , [ 'ROLE_ADMIN' ] ) ) { return true ; } switch ( $ attribute ) { case self :: CREATE : return $ this -> canCreate ( $ user ) ; break ; case self :: EDIT : return $ this -> canEdit ( $ user ) ; break ; case self :: DELETE : return $ this -> canDelete ( $ user ) ; break ; } throw new \ LogicException ( 'This code should not be reached!' ) ; }
Perform a single access check operation on a given attribute, subject and token.
Perform a single access check operation on a given attribute subject and token .