Initial: Tibi-Doku auf Starlight-Basis (Nova-Theme, Docker-Stack, Sync-Skripte)
This commit is contained in:
commit
58502aa3c8
78 files changed
+22860
No files matched your search
@@ -0,0 +1,51 @@
|
||||
---
|
||||
title: 'Impersonation (Admin → User Session)'
|
||||
---
|
||||
|
||||
# Impersonation (Admin → User Session)
|
||||
|
||||
## Scope
|
||||
|
||||
- Impersonation einer Benutzersession durch einen Admin
|
||||
- `POST /login/impersonate` Endpoint im Mock-Interceptor
|
||||
- UI-Trigger im UserDetailDrawer (Button + ConfirmDialog)
|
||||
- Amber-Banner im AdminLayout mit Stop-Button
|
||||
- Rollback zur Admin-Session via `stopImpersonation()`
|
||||
- Berechtigungen: SystemAdmin (role=0) kann alle User impersonaten; OrgAdmin nur User in eigenen Orgs (Serverseitig geprüft)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Run in mock mode only (real impersonation requires live tibi-server)
|
||||
- Admin-Benutzer `admin` (role=0) und Ziel-User `maria.schmidt` (u2) existieren
|
||||
- Zweiter Admin `peter.gross` (u7) existiert für Admin-auf-Admin-Tests
|
||||
- Relevant spec: `tests/e2e/impersonation.spec.ts`
|
||||
|
||||
## Test Cases
|
||||
|
||||
| ID | Description | Expected Result | Priority |
|
||||
| --- | --- | --- | --- |
|
||||
| IMP-01 | Admin sieht "Als Benutzer einloggen"-Button im UserDetailDrawer | Button mit `mdiLogin` Icon ist sichtbar für role=0 | High |
|
||||
| IMP-02 | Admin klickt Impersonate → ConfirmDialog erscheint | ConfirmDialog variant="info" mit Titel und Nachricht | High |
|
||||
| IMP-03 | Admin bestätigt Impersonation → Weiterleitung zu /projects | Amber-Banner "Eingeloggt als @maria.schmidt" sichtbar; User-Menü zeigt Maria Schmidt | High |
|
||||
| IMP-04 | Impersonation-Banner zeigt korrekte Impersonation-Info | Banner enthält "(Impersonation SystemAdmin)" | High |
|
||||
| IMP-05 | Stop-Button im Banner → Admin-Session wiederhergestellt | Zurück zu /projects mit Admin-User im User-Menü; Banner verschwunden | High |
|
||||
| IMP-06 | Nicht-Admin (role=1) sieht KEINEN Impersonate-Button | Button ist nicht sichtbar für maria.schmidt | High |
|
||||
| IMP-07 | Admin sieht Impersonate-Button NICHT für sich selbst | admin (u1) kann sich nicht selbst impersonaten | Medium |
|
||||
| IMP-08 | Admin-zu-Admin Impersonation (admin → peter.gross) funktioniert | Impersonation auf peter.gross möglich; Banner zeigt "@peter.gross" | Medium |
|
||||
| IMP-09 | Impersonation-Banner verschwindet nach page.reload() | sessionStorage stellt impersonatedBy-State wieder her | Medium |
|
||||
| IMP-10 | Admin sieht Impersonate-Button auch für User ohne Org/Team | solo.user (u8) hat Impersonate-Button | Low |
|
||||
|
||||
## Edge Cases
|
||||
|
||||
- Impersonation des eigenen Users: Button muss versteckt sein (canImpersonate = isAdmin && user.id !== currentUser.id)
|
||||
- Mock-Interceptor lehnt Impersonation ab, wenn currentUser nicht role=0 ist (403)
|
||||
- Mock-Interceptor gibt 404 bei unbekannter userId
|
||||
- Nach Stop-Impersonation muss die Admin-Original-Session wiederhergestellt sein (via singleRefresh)
|
||||
- Bei fehlendem Original-Token (sessionStorage gelöscht) → full logout (Fallback)
|
||||
|
||||
## Accessibility
|
||||
|
||||
- Amber-Banner hat `data-ai-id="impersonation-banner"` für Test-Selektion
|
||||
- Stop-Button hat `data-ai-id="impersonation-stop-btn"`
|
||||
- Impersonate-Button hat `data-ai-id="impersonate-btn"`
|
||||
- Farbkontrast: Amber auf hell/dunkel erfüllt WCAG AA
|
||||
Reference in new issue
Block a user