You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Instead of allowing only superuser to impersonate, create a custom permission (can_impersonate) and use a configurable function to check permissions for impersonation.
Function should receive impersonator and impersonee and return True if allowed to impersonate.
Default implementation is the current behavior (if superuser, return True, regardless of who is the target) but apps can override the function in settings.py with one of their own such as:
Instead of allowing only
superuserto impersonate, create a custom permission (can_impersonate) and use a configurable function to check permissions for impersonation.Function should receive
impersonatorandimpersoneeand return True if allowed to impersonate.Default implementation is the current behavior (if superuser, return True, regardless of who is the target) but apps can override the function in settings.py with one of their own such as:
UPDATE: following up on #1, add this new permission to https://github.com/surface-security/django-impersonate/blob/main/impersonate/admin.py#L7. It's not required for security but needed for UX (hide action from those that cannot use it)