<?php

/**
 * Delete workspaces
 *
 * @param string $ids - Workspace IDs, json array
 */

QUI::getAjax()->registerFunction(
    'ajax_desktop_workspace_delete',
    static function ($ids): void {
        $User = QUI::getUserBySession();
        $ids = json_decode($ids, true);

        foreach ($ids as $id) {
            QUI\Workspace\Manager::deleteWorkspace($id, $User);
        }
    },
    ['ids'],
    'Permission::checkUser'
);
