getPermission() public method

public getPermission ( string $name ) : string
$name string
return string
 function it_uses_rbac_authorization_checker(RequestConfiguration $requestConfiguration, RbacAuthorizationCheckerInterface $rbacAuthorizationChecker)
 {
     $requestConfiguration->hasPermission()->willReturn(true);
     $requestConfiguration->getPermission('sylius.product.foo')->willReturn('sylius.product.foo');
     $rbacAuthorizationChecker->isGranted('sylius.product.foo')->willReturn(false);
     $this->isGranted($requestConfiguration, 'sylius.product.foo')->shouldReturn(false);
     $rbacAuthorizationChecker->isGranted('sylius.product.foo')->willReturn(true);
     $this->isGranted($requestConfiguration, 'sylius.product.foo')->shouldReturn(true);
 }
Example #2
0
 /**
  * @param RequestConfiguration $configuration
  * @param string $permission
  *
  * @throws AccessDeniedException
  */
 protected function isGrantedOr403(RequestConfiguration $configuration, $permission)
 {
     if (!$configuration->hasPermission()) {
         return;
     }
     $permission = $configuration->getPermission($permission);
     if (!$this->authorizationChecker->isGranted($configuration, $permission)) {
         throw new AccessDeniedException();
     }
 }