Files
kundenplattform/workspace_creator.py
adminandClaude Opus 5.5 8cc98698e3 Workspace-Creator für Kunden je Organisation freischaltbar
- Freischaltung je Organisation (Portal-Migration 0010, alle bisherigen
  Organisationen = Testschulen frei), Schalter unter Admin › Organisation ›
  Organisationsdaten
- Kunden-Creator auf den Stand des Admin-Creators: Assistent mit Distro,
  Entwurf/Veröffentlichen, Webapps, Standardbrowser, Kopie, Löschen;
  gemeinsame Vorlagen _workspace_detail.html/_workspace_assistent.html
- Vorlagen von tuxflotte nur lesend, ohne fremde Nutzung; Kopie immer in
  die eigene Organisation
- Organisation › Struktur: Workspace je OE zuweisen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:57:07 +02:00

33 lines
1.1 KiB
Python

from db import get_database_connection
# Workspace-Creator je Organisation (GUI-Runde 23.10.2026, siehe
# migrations/0010_workspace_creator_freischaltung.sql): der Root-Admin
# schaltet ihn frei, ohne Eintrag ist er gesperrt.
def ist_freigeschaltet(organization_id) -> bool:
with get_database_connection() as conn:
with conn.cursor() as cur:
cur.execute(
"SELECT frei FROM workspace_creator_freischaltung WHERE organization_id = %s",
(str(organization_id),),
)
row = cur.fetchone()
return bool(row and row[0])
def setze_freischaltung(organization_id: str, frei: bool) -> None:
with get_database_connection() as conn:
with conn.cursor() as cur:
cur.execute(
"""
INSERT INTO workspace_creator_freischaltung (organization_id, frei, updated_at)
VALUES (%s, %s, CURRENT_TIMESTAMP)
ON CONFLICT (organization_id) DO UPDATE
SET frei = EXCLUDED.frei, updated_at = CURRENT_TIMESTAMP
""",
(organization_id, frei),
)