Ressourcen (Mail, Nextcloud, ownCloud, WebDAV, SMB, Web-Proxy) gehoeren zur Organisation und wirken fuer die ganze Org, OEs samt Unter-OEs oder Geraetegruppen. Keine Zugangsdaten: unbekannte Felder werden verworfen. Der Check-in schickt die fuer das Geraet geltenden Ressourcen (spezifisch zuerst) als Auftrag org-ressourcen, vorerst nur fuer Organisationen mit Ausrollstufe vorab (ORG_RESSOURCEN_NUR_VORAB). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
2.0 KiB
PL/PgSQL
50 lines
2.0 KiB
PL/PgSQL
BEGIN;
|
|
|
|
-- Org-Ressourcen (15.10.2026, platform-docs roadmap/org-ressourcen-konzept.md,
|
|
-- Schritt 1): lokale Dienste einer Organisation (Mail, Nextcloud, ownCloud,
|
|
-- WebDAV, SMB, Web-Proxy), einmal zentral vom Kunden-Admin gepflegt. App-
|
|
-- Rollen auf dem Gerät nutzen sie zum Vorbefüllen (Server, Ports), der
|
|
-- Benutzer gibt nur noch Name und Passwort ein.
|
|
--
|
|
-- Bewusst KEINE Zugangsdaten: der Server nimmt in daten keine Passwort-
|
|
-- oder Benutzer-Felder an (Typ-Definitionen in app.py, ORG_RESSOURCEN_TYPEN).
|
|
-- Die Ressource gehört zur Organisation, nicht zum Workspace, weil
|
|
-- Workspaces über Kundengruppen von mehreren Organisationen genutzt werden.
|
|
|
|
CREATE TABLE org_ressourcen (
|
|
id UUID PRIMARY KEY,
|
|
organization_id UUID NOT NULL
|
|
REFERENCES organizations(id)
|
|
ON DELETE CASCADE,
|
|
typ TEXT NOT NULL
|
|
CHECK (typ IN ('mail', 'nextcloud', 'owncloud', 'webdav', 'smb', 'proxy')),
|
|
name TEXT NOT NULL,
|
|
daten JSONB NOT NULL DEFAULT '{}'::jsonb,
|
|
-- Wirkung: ganze Organisation, sonst nur die Ziele aus
|
|
-- org_ressourcen_ziele (OE samt Unter-OEs, Gerätegruppe). Ohne Ziel und
|
|
-- ohne ganze Organisation wirkt die Ressource nirgends (gepflegt, aber
|
|
-- nicht verteilt).
|
|
ganze_organisation BOOLEAN NOT NULL DEFAULT TRUE,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
UNIQUE (organization_id, name)
|
|
);
|
|
|
|
CREATE TABLE org_ressourcen_ziele (
|
|
ressource_id UUID NOT NULL
|
|
REFERENCES org_ressourcen(id)
|
|
ON DELETE CASCADE,
|
|
oe_id UUID
|
|
REFERENCES organisationseinheiten(id)
|
|
ON DELETE CASCADE,
|
|
gruppe_id UUID
|
|
REFERENCES gruppen(id)
|
|
ON DELETE CASCADE,
|
|
CHECK ((oe_id IS NULL) <> (gruppe_id IS NULL))
|
|
);
|
|
|
|
CREATE UNIQUE INDEX org_ressourcen_ziele_oe ON org_ressourcen_ziele (ressource_id, oe_id) WHERE oe_id IS NOT NULL;
|
|
CREATE UNIQUE INDEX org_ressourcen_ziele_gruppe ON org_ressourcen_ziele (ressource_id, gruppe_id) WHERE gruppe_id IS NOT NULL;
|
|
|
|
COMMIT;
|