Aufraeumen: Schulcomputer Basis entfernt, Workspace-Liste mit Freigabe-Namen

Testprofile von Default Lab und WLAN-Test zeigen auf die Vorlagen
Schulcomputer (Mint/Debian/Ubuntu) derselben Distro, die Basis-Workspaces
entfallen (Migration 0054). fetch_workspaces() liefert die Namen der
freigegebenen Kundengruppen/Organisationen fuer Anzeigen wie
"Vorlage fuer Schulen".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-07 16:06:08 +02:00
1 parent 1288097927
commit f4c306e389
2 files changed
+43 -2

No files matched your search

+11 -2
View File
@@ -3099,7 +3099,13 @@ def fetch_workspaces():
(SELECT max(nummer) FROM workspace_versionen v
WHERE v.workspace_id = w.id AND v.status = 'veroeffentlicht'),
EXISTS (SELECT 1 FROM workspace_versionen v
WHERE v.workspace_id = w.id AND v.status = 'entwurf')
WHERE v.workspace_id = w.id AND v.status = 'entwurf'),
ARRAY(SELECT k.name FROM workspace_freigabe_kundengruppen f
JOIN kundengruppen k ON k.id = f.kundengruppe_id
WHERE f.workspace_id = w.id ORDER BY k.sort_order),
ARRAY(SELECT o2.name FROM workspace_freigabe_organisationen f
JOIN organizations o2 ON o2.id = f.organization_id
WHERE f.workspace_id = w.id ORDER BY o2.name)
FROM workspaces w
LEFT JOIN organizations o ON o.id = w.organization_id
LEFT JOIN backends b ON b.id = w.backend_id
@@ -3122,11 +3128,14 @@ def fetch_workspaces():
"sichtbarkeit": sichtbarkeit,
"version": version,
"hat_entwurf": hat_entwurf,
# Für Anzeigen wie "Vorlage für Schulen" (07.10.2026)
"freigabe_kundengruppen": list(kundengruppen_namen),
"freigabe_organisationen": list(organisationen_namen),
}
for (
wid, key, name, description, organization_id, organization_name,
backend_id, backend_name, backend_version, ist_vorlage, sichtbarkeit,
version, hat_entwurf,
version, hat_entwurf, kundengruppen_namen, organisationen_namen,
) in cur.fetchall()
]
@@ -0,0 +1,32 @@
BEGIN;
-- Aufräumen (Nutzer-Entscheidung 07.10.2026): "Schulcomputer Basis
-- (Mint/Debian/Ubuntu)" war nur der alte 3-Merkmale-Stand für die Testprofile
-- von Default Lab und WLAN-Test (Migration 0052). Diese Profile zeigen jetzt
-- auf die Vorlagen "Schulcomputer (…)" derselben Distro; danach entfallen die
-- Basis-Workspaces. Test-Geräte dieser Profile bekommen beim nächsten
-- Check-in den vollen Schulcomputer.
UPDATE bereitstellungsvorlagen bv
SET workspace_id = ziel.id, updated_at = now()
FROM workspaces basis, workspaces ziel
WHERE bv.workspace_id = basis.id
AND basis.organization_id IS NULL AND basis.key LIKE 'schulcomputer-basis-%'
AND ziel.organization_id IS NULL AND ziel.key = replace(basis.key, 'schulcomputer-basis-', 'schulcomputer-')
AND ziel.backend_id = basis.backend_id;
DO $$
BEGIN
IF EXISTS (
SELECT 1 FROM bereitstellungsvorlagen bv JOIN workspaces w ON w.id = bv.workspace_id
WHERE w.key LIKE 'schulcomputer-basis-%' AND w.organization_id IS NULL
) OR EXISTS (
SELECT 1 FROM organisationseinheiten oe JOIN workspaces w ON w.id = oe.workspace_id
WHERE w.key LIKE 'schulcomputer-basis-%' AND w.organization_id IS NULL
) THEN
RAISE EXCEPTION 'Schulcomputer Basis wird noch verwendet';
END IF;
END $$;
DELETE FROM workspaces WHERE organization_id IS NULL AND key LIKE 'schulcomputer-basis-%';
COMMIT;