当前位置: 首页>>代码示例>>PHP>>正文


PHP RequestConfiguration::hasPermission方法代码示例

本文整理汇总了PHP中Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration::hasPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestConfiguration::hasPermission方法的具体用法?PHP RequestConfiguration::hasPermission怎么用?PHP RequestConfiguration::hasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration的用法示例。


在下文中一共展示了RequestConfiguration::hasPermission方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isGranted

 /**
  * @param RequestConfiguration $requestConfiguration
  * @param string $permission
  *
  * @return bool
  */
 public function isGranted(RequestConfiguration $requestConfiguration, $permission)
 {
     if (!$requestConfiguration->hasPermission()) {
         return true;
     }
     return $this->rbacAuthorizationChecker->isGranted($permission);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:13,代码来源:RbacAuthorizationChecker.php

示例2:

 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);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:9,代码来源:RbacAuthorizationCheckerSpec.php

示例3: get

 /**
  * {@inheritdoc}
  */
 public function get(RequestConfiguration $requestConfiguration, RepositoryInterface $repository)
 {
     if ($requestConfiguration->hasPermission() && $this->requireOwnerCheck($vars = $requestConfiguration->getVars())) {
         $owner = $this->currentIdentityProvider->getIdentity();
         $ownerField = is_bool($vars['acl_owner']) ? ResourceOwnerFilter::FIELD : $vars['acl_owner'];
         // using in grid param
         $requestConfiguration->getRequest()->query->set(ResourceOwnerFilter::TYPE, $owner);
         $criteria = $requestConfiguration->getCriteria();
         $criteria[$ownerField] = $owner;
         $requestConfiguration->getParameters()->set('criteria', $criteria);
     }
     return $this->decoratedResolver->get($requestConfiguration, $repository);
 }
开发者ID:liverbool,项目名称:dos-resource-bundle,代码行数:16,代码来源:ResourcesCollectionProvider.php

示例4: isGrantedOr403

 /**
  * @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();
     }
 }
开发者ID:sylius,项目名称:sylius,代码行数:16,代码来源:ResourceController.php


注:本文中的Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration::hasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。