yii\rbac\DbManager::getDirectPermissionsByUser PHP Метод

getDirectPermissionsByUser() защищенный Метод

Returns all permissions that are directly assigned to user.
С версии: 2.0.7
protected getDirectPermissionsByUser ( string | integer $userId ) : Permission[]
$userId string | integer the user ID (see [[\yii\web\User::id]])
Результат Permission[] all direct permissions that the user has. The array is indexed by the permission names.
    protected function getDirectPermissionsByUser($userId)
    {
        $query = (new Query())->select('b.*')->from(['a' => $this->assignmentTable, 'b' => $this->itemTable])->where('{{a}}.[[item_name]]={{b}}.[[name]]')->andWhere(['a.user_id' => (string) $userId])->andWhere(['b.type' => Item::TYPE_PERMISSION]);
        $permissions = [];
        foreach ($query->all($this->db) as $row) {
            $permissions[$row['name']] = $this->populateItem($row);
        }
        return $permissions;
    }