yii\rbac\PhpManager::checkAccess PHP Method

checkAccess() public method

public checkAccess ( $userId, $permissionName, $params = [] )
    public function checkAccess($userId, $permissionName, $params = [])
    {
        $assignments = $this->getAssignments($userId);
        return $this->checkAccessRecursive($userId, $permissionName, $params, $assignments);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function checkAccess($userId, $permissionName, $params = [])
 {
     $permissionName = preg_replace('#^\\/(.*)#', '$1', $permissionName);
     foreach ($this->getPermissions() as $permission) {
         if ($permission->type == $permission::TYPE_ROLE) {
             continue;
         }
         if (!preg_match('#^' . $permission->name . '$#', $permissionName)) {
             continue;
         }
         if (parent::checkAccess($userId, $permission->name, $params)) {
             return true;
         }
     }
     return parent::checkAccess($userId, $permissionName, $params);
 }
All Usage Examples Of yii\rbac\PhpManager::checkAccess