98 lines
1.8 KiB
Plaintext
98 lines
1.8 KiB
Plaintext
AZA – Admin: Plan setzen (ohne UI)
|
||
|
||
Voraussetzung:
|
||
- Setze die Umgebungsvariable AZA_ADMIN_KEY auf ein geheimes Passwort (z.B. "SUPERSECRET123")
|
||
- Server neu starten
|
||
|
||
Endpoint:
|
||
POST /admin/set_plan
|
||
|
||
Body (JSON):
|
||
{
|
||
"admin_key": "SUPERSECRET123",
|
||
"email": "user@example.com",
|
||
"plan": "pro"
|
||
}
|
||
|
||
Beispiele für Plans:
|
||
- basic -> Default Geräte-Limit (AZA_DEVICE_LIMIT_DEFAULT, typischerweise 2)
|
||
- pro -> 4 Geräte (Fallback) oder via AZA_PLAN_LIMITS
|
||
- custom -> nur sinnvoll, wenn AZA_PLAN_LIMITS gesetzt ist, z.B.:
|
||
AZA_PLAN_LIMITS="basic:2,pro:4,business:10"
|
||
|
||
Hinweis:
|
||
- Plan-Änderung wirkt beim nächsten /license/check sofort.
|
||
|
||
|
||
---
|
||
Admin: Token sperren (Logout / Sperre)
|
||
|
||
Endpoint:
|
||
POST /admin/revoke_token
|
||
|
||
Body (JSON):
|
||
{
|
||
"admin_key": "SUPERSECRET123",
|
||
"token": "PASTE_TOKEN_HERE"
|
||
}
|
||
|
||
Ergebnis:
|
||
- Das Token ist danach ungültig (revoked=1)
|
||
- /license/check gibt dann 401 "Invalid or revoked token"
|
||
|
||
|
||
---
|
||
Admin: Account-Status setzen (Abo-Status)
|
||
|
||
Ziel:
|
||
- active = normal
|
||
- suspended = Zugriff gesperrt (z.B. Zahlung fehlgeschlagen)
|
||
- cancelled = Zugriff gesperrt (Abo beendet)
|
||
|
||
Endpoint:
|
||
POST /admin/set_status
|
||
|
||
Body (JSON):
|
||
{
|
||
"admin_key": "SUPERSECRET123",
|
||
"email": "user@example.com",
|
||
"status": "suspended"
|
||
}
|
||
|
||
Hinweis:
|
||
- Blockt sowohl /login als auch /license/check mit HTTP 403 "Account not active".
|
||
|
||
|
||
---
|
||
Audit-Log (Admin-Aktionen)
|
||
|
||
Was wird geloggt:
|
||
- set_plan (alt -> neu)
|
||
- set_status (alt -> neu)
|
||
- revoke_token (active -> revoked)
|
||
|
||
Wo:
|
||
- SQLite Tabelle: admin_audit
|
||
|
||
Spalten:
|
||
- action, email, token, old_value, new_value, created_at
|
||
|
||
Hinweis:
|
||
- Das Audit-Log ist rein serverseitig (kein UI), dient Support & Nachvollziehbarkeit.
|
||
|
||
|
||
---
|
||
Audit-Log anzeigen (Admin)
|
||
|
||
Endpoint:
|
||
POST /admin/audit/list
|
||
|
||
Body (JSON):
|
||
{
|
||
"admin_key": "SUPERSECRET123",
|
||
"limit": 50
|
||
}
|
||
|
||
Ergebnis:
|
||
- Liste der letzten Audit-Einträge (neueste zuerst)
|