django-impersonate
This Django app lets admin users impersonate other users, useful when testing and debugging permissions.
Non superusers are not allowed to perform this request, even if they have view rights to the User model, so that this cannot be used for privilege escalation.
As admin, I can choose the "Impersonate" action:
Impersonations are terminated by closing the bottom left pop-up.
Impersonate is not available for regular users, returning an error for those with view rights to the User model.
Setup
Add middleware to your middleware list and make sure it comes after django.contrib.auth.middleware.AuthenticationMiddleware:
MIDDLEWARE = [
...
'django.contrib.auth.middleware.AuthenticationMiddleware',
...
'impersonate.middleware.ImpersonateMiddleware',
...
]
In one of your admin.py files, add the action to UserAdmin (or the admin model of your custom User)
from impersonate.admin import impersonate_action
from django.contrib.auth import admin
admin.UserAdmin.actions.append(impersonate_action)
Or call it from any of your views (if you're not using django-admin)
from django.contrib.auth import models
from impersonate.admin import impersonate_action
def my_view(request, target_username):
return impersonate_action(None, request, models.User.objects.filter(username=target_username))
Metadata
Release files for django-impersonator 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_impersonator-0.0.3.tar.gz | 9.4 kB | Without provenance | Details for django_impersonator-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_impersonator-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for django_impersonator-0.0.3-py3-none-any.whl |
Total release size: 14.9 kB
Release files / django_impersonator-0.0.3.tar.gz
| Download URL | django_impersonator-0.0.3.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a8a9a7af675c213abada1eb4583dc527d4a6f574610c463c833723ff8ca9924
|
|
BLAKE2b-256 checksum How to use checksums |
fb1188a5ff7c545bc6cf2386cec161a73f62b5447d4aa080eec3c557a75ae179
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / django_impersonator-0.0.3-py3-none-any.whl
| Download URL | django_impersonator-0.0.3-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02bb367b645c06f3d33875e48dc5f84764c47f8f34d8fa041b31eeb79d097ad6
|
|
BLAKE2b-256 checksum How to use checksums |
fa1203d75ba7dd5d4cc0188b79762bb2d81e72959ccd2f0de2bf8da93ebfe777
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for django-impersonator 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.