user verwaltung
Build und Push Docker Image / build-and-push (push) Successful in 7s

This commit is contained in:
2026-11-05 13:00:31 +01:00
parent ad2019c9aa
commit 8713a8c25d
18 changed files with 708 additions and 91 deletions
+15
View File
@@ -114,5 +114,20 @@ def migrate():
(int(time.time()),),
)
cur.execute('UPDATE "Tablets" SET ziel_typ = NULL, maschine_id = NULL WHERE ziel_typ = \'auswahl\'')
cur.execute('ALTER TABLE "Tablet_Verlauf" ADD COLUMN IF NOT EXISTS "benutzer" text')
# Benutzer mit Rechten (Passwörter nur als Hash)
cur.execute(
'CREATE TABLE IF NOT EXISTS "Benutzer" ('
'"id" serial PRIMARY KEY, "benutzername" text NOT NULL, "anzeigename" text, "passwort_hash" text NOT NULL, '
'"admin" boolean NOT NULL DEFAULT false, '
'"recht_auftraege" boolean NOT NULL DEFAULT false, "recht_korrektur" boolean NOT NULL DEFAULT false, '
'"recht_geraete" boolean NOT NULL DEFAULT false, "recht_maschinen" boolean NOT NULL DEFAULT false, '
'"aktiv" boolean NOT NULL DEFAULT true, "erstellt_am" bigint, "letzter_login" bigint)'
)
cur.execute('CREATE UNIQUE INDEX IF NOT EXISTS "benutzer_name_lc" ON "Benutzer" (lower("benutzername"))')
cur.execute(
'CREATE TABLE IF NOT EXISTS "Benutzer_Verlauf" ('
'"id" serial PRIMARY KEY, "zeitpunkt" bigint NOT NULL, "akteur" text, "aktion" text NOT NULL, "details" text)'
)
cur.execute('CREATE TABLE IF NOT EXISTS "Einstellungen" ("schluessel" text PRIMARY KEY, "wert" text)')
log.info("Schema-Migration geprüft/angewendet.")