コード例 #1
0
ファイル: Role.php プロジェクト: webowy/zend-acl
 /**
  * @param string $roleId
  * @param $label
  * @param bool|true $isEditable
  * @param bool|true $isDeletable
  * @param null $parentId
  */
 public function __construct($roleId, $label, $isEditable = true, $isDeletable = true, $parentId = null)
 {
     parent::__construct($roleId);
     $this->setLabel($label);
     $this->setIsEditable($isEditable);
     $this->setIsDeletable($isDeletable);
     $this->setParentId($parentId);
 }
コード例 #2
0
ファイル: HierarchicalRole.php プロジェクト: coolms/acl
 /**
  * @param string|RoleInterface|null                 $roleId
  * @param string|RoleInterface|RoleInterface[]|null $parent
  */
 public function __construct($roleId, $parent = null)
 {
     if ($roleId instanceof RoleInterface) {
         $roleId = $roleId->getRoleId();
     }
     parent::__construct($roleId);
     $this->setParent($parent);
 }
コード例 #3
0
ファイル: BaseRole.php プロジェクト: lpj0017/easypay
 function __construct($name = '')
 {
     parent::__construct(get_class($this));
     $this->name = $name;
 }
コード例 #4
0
ファイル: Authenticated.php プロジェクト: parrotcage/fovea
 /**
  * Constructor
  *
  * @param string $identity
  * @param $role
  */
 public function __construct($identity, $role = 'consumer')
 {
     $this->identity = $identity;
     parent::__construct($role);
 }
コード例 #5
0
ファイル: Guest.php プロジェクト: parrotcage/fovea
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct(static::$role);
 }
コード例 #6
0
ファイル: AuthorizationService.php プロジェクト: coolms/acl
 /**
  * @param string|RoleInterface $role
  * @throws InvalidRoleException
  */
 private function loadRole($role)
 {
     if ($this->acl->hasRole($role)) {
         return;
     }
     $parent = null;
     if (is_string($role)) {
         $role = new GenericRole($role);
     } elseif ($role instanceof RoleProvider && ($parent = $role->getRoles())) {
         $this->loadRoles($parent);
     } elseif ($role instanceof HierarchicalRoleInterface && ($parent = $role->getParent())) {
         is_array($parent) ? $this->loadRoles($parent) : $this->loadRole($parent);
     } elseif (!$role instanceof RoleInterface) {
         throw InvalidRoleException::invalidRoleInstance($role);
     }
     $this->acl->addRole($role, $parent);
 }