<?php
declare(strict_types=1);
/**
* AdminPermissiveVoter.php File.
* This file is part of the Payment.net Project.
*
* PHP version 5
*
* @category Admin private api
* @package Bdm\AdminBundle\Security\Authorization\Voter
* @author Pavel Baraulya <pbaraulya@bdmultimedia.fr>
* @link http://www.payment.net/
*
* FEATURES :
* ==========
*
* TODO-LIST :
* ===========
*
* HISTORY :
* =========
* 20150709 - Pavel Baraulya
*
**/
namespace Bdm\AdminBundle\Security\Authorization\Voter;
use Bdm\AdminBundle\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
/**
* Voter for admin users, everything is allowed
*/
class AdminPermissiveVoter extends Voter
{
/**
* @param string $sAttribute attribute
* @param mixed $oSubject subject
* @return bool
*/
public function supports($sAttribute, $oSubject)
{
return true;
}
/**
* @param string $sAttr attr
* @param mixed $mEntity entity
* @param TokenInterface $oToken token
*
* @return bool
*/
protected function voteOnAttribute($sAttr, $mEntity, TokenInterface $oToken)
{
return $oToken->getUser() instanceof User;
}
}