コード例 #1
0
 protected function isAllowed($resource, $privilege)
 {
     if (null === $this->allowedService) {
         $this->allowedService = $this->getServiceLocator()->get(Authorize::class);
     }
     return $this->allowedService->isAllowed($resource, $privilege);
 }
コード例 #2
0
ファイル: IsAllowed.php プロジェクト: NguyenQuiDuong/Funix
 /**
  * @param mixed      $resource
  * @param mixed|null $privilege
  * @return bool
  */
 public function __invoke($resource, $privilege = null)
 {
     return $this->authorizeService->isAllowed($resource, $privilege);
 }
コード例 #3
0
 /**
  * @param \BjyAuthorize\Service\Authorize $authorizeService
  * @param \stdClass                       $entity
  */
 public function it_should_use_classname_if_entity_is_no_ResourceInterface($authorizeService, $entity)
 {
     $authorizeService->isAllowed(Argument::cetera())->willReturn(true);
     $this->mockListenerFactory($authorizeService->getWrappedObject());
     $className = get_class($entity->getWrappedObject());
     $permission = 'permission';
     $this->isAllowed($entity, $permission);
     $authorizeService->isAllowed($className, $permission)->shouldBeCalled();
 }