Wagtail extension to allow superusers to "impersonate" other accounts within the Wagtail admin interface.
Version: 0.1.0
Author: Stepan Pliaskin
wagtail-impersonate
is a Wagtail-specific extension built on top of django-impersonate. It enables superusers to impersonate other users, making it easier to debug and troubleshoot user-specific issues or permissions.
To configure wagtail-impersonate
, you must first configure django-impersonate
. This extension relies on the underlying functionality provided by django-impersonate
, so it's essential to follow its setup instructions for proper integration.
Please refer to the django-impersonate documentation for more details on how to configure it correctly.
- Wagtail 6.1 and newer
- django-impersonate 1.9.4 and newer
Install via pip:
pip install wagtail-impersonate
-
Add
impersonate
andwagtail_impersonate
to yourINSTALLED_APPS
:INSTALLED_APPS = [ ... 'impersonate', 'wagtail_impersonate', ... ]
-
Add the
ImpersonateMiddleware
to yourMIDDLEWARE
setting after thedjango.contrib.auth.*
middleware:MIDDLEWARE = [ ... 'django.contrib.auth.middleware.AuthenticationMiddleware', 'impersonate.middleware.ImpersonateMiddleware', ... ]
-
Add the
impersonate
URLs to your project's URL configuration:from django.urls import path, include urlpatterns = [ path("admin/", include(wagtailadmin_urls)), path("impersonate/", include('impersonate.urls')), # other urls... ]
To use the impersonation feature:
- Navigate to Settings -> Users in the Wagtail admin.
- Locate the user you wish to impersonate, click on the three dots next to their name (More options), and select the Impersonate button.
To stop impersonating, click the Stop Impersonation button in the admin sidebar.
As wagtail-impersonate
is a wrapper around django-impersonate
, you need to configure certain settings in settings.py
as per the django-impersonate README.
Here are some key settings to pay attention to:
IMPERSONATE = {
"URI_EXCLUSIONS": [], # URIs where impersonation should be disabled
"REDIRECT_FIELD_NAME": "next", # URL parameter to redirect after impersonation
"REDIRECT_URL": "/", # Default redirect after impersonation ends
}
Please refer to the django-impersonate documentation for a complete list of configuration options.
This project is licensed under the MIT License. See the LICENSE file for details.