diff --git a/biscuit/core/settings.py b/biscuit/core/settings.py index db1c1349f235fa202f579fe365efb66304c82cb8..fb4942d2043dd2e5205aaf4351b4574587749e83 100644 --- a/biscuit/core/settings.py +++ b/biscuit/core/settings.py @@ -51,6 +51,7 @@ INSTALLED_APPS = [ 'settings_context_processor', 'sass_processor', 'easyaudit', + 'impersonate', 'bootstrap4', 'fa', 'django_any_js', @@ -90,6 +91,7 @@ MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'impersonate.middleware.ImpersonateMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'easyaudit.middleware.easyaudit.EasyAuditMiddleware', @@ -274,4 +276,10 @@ MAINTENANCE_MODE_IGNORE_IP_ADDRESSES = _settings.get( MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS = 'ipware.ip.get_ip' MAINTENANCE_MODE_IGNORE_SUPERUSER = True +IMPERSONATE = { + 'USE_HTTP_REFERER': True, + 'REQUIRE_SUPERUSER': True, + 'ALLOW_SUPERUSER': True +} + _settings.populate_obj(sys.modules[__name__]) diff --git a/biscuit/core/urls.py b/biscuit/core/urls.py index 4e7d3ac62e59d2a66cba3f39a3ae558fb1c550f0..2ccb4f749f9eb6566ec47fd8ee1559b10b26b495 100644 --- a/biscuit/core/urls.py +++ b/biscuit/core/urls.py @@ -27,6 +27,7 @@ urlpatterns = [ path('', views.index, name='index'), path('maintenance-mode/', include('maintenance_mode.urls')), path('contact/', include('contact_form.urls')), + path('impersonate/', include('impersonate.urls')), path('__i18n__/', include('django.conf.urls.i18n')) ] diff --git a/pyproject.toml b/pyproject.toml index 768f1ac01d7e02718d917ceb4284ddf61479ad6a..cba2ad8b70e4a0e4af9e6b42e88b132b19e5206f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ django-ipware = "^2.1" easy-thumbnails = "^2.6" django-image-cropping = "^1.2" django-contact-form = "^1.7" +django-impersonate = "^1.4" [tool.poetry.extras] ldap = ["django-auth-ldap"]