Fix: Verhindere Admin-Aussperrung im Impersonate-Modus bei aktivem Wa…#50
Fix: Verhindere Admin-Aussperrung im Impersonate-Modus bei aktivem Wa…#50
Conversation
…rtungsmodus - Füge Prüfung für Impersonator-Berechtigung in checkBackend() hinzu - Admins können sich jetzt nicht mehr selbst aussperren, wenn sie im Wartungsmodus die Identität eines anderen Benutzers annehmen - Löst GitHub Issue #49: Admin wird aus Backend ausgesperrt Die Änderung erweitert die checkBackend()-Methode um eine zusätzliche Prüfung: Wenn sich ein Benutzer im Impersonate-Modus befindet, wird geprüft, ob der ursprüngliche Benutzer (Impersonator) ein Administrator ist. Falls ja, wird der Zugriff gewährt, auch wenn der aktuell 'verkörperte' Benutzer kein Administrator ist.
There was a problem hiding this comment.
Pull Request Overview
This PR adds impersonation mode support to the backend maintenance check. When a user is impersonating another user, the system now checks if the original impersonator is an admin, allowing admin impersonators to bypass backend maintenance mode.
- Adds impersonator admin check to allow admins to access backend during maintenance mode when impersonating other users
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Im Impersonate-Modus: Prüfen, ob der ursprüngliche Benutzer (Impersonator) ein Admin ist | ||
| $impersonator = rex::getImpersonator(); | ||
| if ($impersonator instanceof rex_user && $impersonator->isAdmin()) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
The impersonator check grants admin privileges during backend maintenance mode, but this creates a security concern: an admin could impersonate a non-admin user to test restricted functionality, but still bypass maintenance mode restrictions. This defeats the purpose of testing how non-admin users experience the maintenance mode. Consider whether this bypass should only apply when the current user (rex::getUser()) is also an admin, or if the impersonator check should be removed to ensure proper testing of the maintenance experience for non-admin users.
| // Im Impersonate-Modus: Prüfen, ob der ursprüngliche Benutzer (Impersonator) ein Admin ist | |
| $impersonator = rex::getImpersonator(); | |
| if ($impersonator instanceof rex_user && $impersonator->isAdmin()) { | |
| return; | |
| } | |
| // Hinweis: Impersonator-Check entfernt, damit Admins im Impersonate-Modus nicht Wartungsmodus umgehen können |
…rtungsmodus
Die Änderung erweitert die checkBackend()-Methode um eine zusätzliche Prüfung: Wenn sich ein Benutzer im Impersonate-Modus befindet, wird geprüft, ob der ursprüngliche Benutzer (Impersonator) ein Administrator ist. Falls ja, wird der Zugriff gewährt, auch wenn der aktuell 'verkörperte' Benutzer kein Administrator ist.