for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Authorization;
use Sylius\Bundle\ResourceBundle\Controller\AuthorizationCheckerInterface as ResourceBundleAuthorizationCheckerInterface;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Component\Rbac\Authorization\AuthorizationCheckerInterface;
/**
* @author Paweł Jędrzejewski <[email protected]>
class RbacAuthorizationChecker implements ResourceBundleAuthorizationCheckerInterface
{
* @var AuthorizationCheckerInterface
private $rbacAuthorizationChecker;
* @param AuthorizationCheckerInterface $rbacAuhtorizationChecker
public function __construct(AuthorizationCheckerInterface $rbacAuhtorizationChecker)
$this->rbacAuthorizationChecker = $rbacAuhtorizationChecker;
}
* @param RequestConfiguration $requestConfiguration
* @param string $permission
* @return bool
public function isGranted(RequestConfiguration $requestConfiguration, $permission)
if (!$requestConfiguration->hasPermission()) {
return true;
return $this->rbacAuthorizationChecker->isGranted($permission);