yii\rbac\ManagerInterface::getRole PHP Method

getRole() public method

Returns the named role.
public getRole ( string $name ) : null | Role
$name string the role name.
return null | Role the role corresponding to the specified name. Null is returned if no such role.
    public function getRole($name);

Usage Example

示例#1
0
 /**
  * Revokes a roles and permissions from the user.
  *
  * @param array $items
  *
  * @return int number of successful revoke
  */
 public function revoke($items)
 {
     foreach ($items as $name) {
         $item = $this->manager->getRole($name);
         $item = $item ?: $this->manager->getPermission($name);
         $this->manager->revoke($item, $this->userId);
     }
     return true;
 }
All Usage Examples Of yii\rbac\ManagerInterface::getRole