Merge branch 'feature/iam-05-ldap-active-directory-anbindung' into feature/qa-02-pruefgate-identitaet-mandanten

# Conflicts:
#	scripts/reset-test-env.sh
#	scripts/run-checks.sh
This commit is contained in:
sysops
2026-08-29 00:10:39 +02:00
10 changed files with 647 additions and 0 deletions
@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS role_assignment_history;
DROP TABLE IF EXISTS role_assignments;
@@ -0,0 +1,23 @@
-- Rollenzuweisung pro Benutzer (RBAC-01, siehe core-kanban/tickets/RBAC-01.md).
-- Nur 'user' und 'tenant_admin' sind hier zuweisbar — 'superadmin' lebt
-- mandantenuebergreifend in der Registry (IAM-01 SuperadminStore) und hat
-- daher bewusst KEINE Zeile in dieser tenant-lokalen Tabelle (Akzeptanz-
-- kriterium 1: nur Zuweisungen innerhalb der erlaubten Matrix).
CREATE TABLE role_assignments (
user_id UUID PRIMARY KEY REFERENCES users(id),
role TEXT NOT NULL CHECK (role IN ('user', 'tenant_admin')),
granted_by TEXT NOT NULL,
granted_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Vollstaendige Historie jeder Rollenaenderung (Akzeptanzkriterium 3: wer
-- hat wann welche Rolle vergeben).
CREATE TABLE role_assignment_history (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL,
role TEXT NOT NULL,
granted_by TEXT NOT NULL,
granted_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX role_assignment_history_user_idx ON role_assignment_history (user_id, granted_at);
+2
View File
@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS ldap_group_role_mapping;
DROP TABLE IF EXISTS ldap_config;
+22
View File
@@ -0,0 +1,22 @@
-- LDAP/Active-Directory-Anbindung (IAM-05, siehe core-kanban/tickets/IAM-05.md).
-- Bind-Credentials liegen NIE in dieser Tabelle im Klartext — bind_password_env
-- nennt nur den Namen einer Umgebungsvariable, aus der das Passwort zur
-- Laufzeit gelesen wird (Projekt-Konvention: Secrets nur ueber Env-Vars).
CREATE TABLE ldap_config (
id BOOLEAN PRIMARY KEY DEFAULT true CHECK (id),
url TEXT NOT NULL,
bind_dn TEXT NOT NULL,
bind_password_env TEXT NOT NULL,
base_dn TEXT NOT NULL,
user_filter TEXT NOT NULL DEFAULT '(objectClass=person)',
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Erlaubnis-Matrix LDAP-Gruppe -> NEXARCH-Rolle (Akzeptanzkriterium 3).
-- Eine LDAP-Gruppe OHNE Eintrag hier vergibt KEINE Rolle — kein impliziter
-- Zugriff durch Gruppennamen-Zufall (Privilege-Escalation-Schutz, siehe
-- "Bekannte Fehler vermeiden" im Ticket).
CREATE TABLE ldap_group_role_mapping (
ldap_group TEXT PRIMARY KEY,
role TEXT NOT NULL CHECK (role IN ('user', 'tenant_admin'))
);