Commit 2b4e828c authored by Daniel Klaffenbach's avatar Daniel Klaffenbach 🐍

Add middleware for development

parent 1a7a7e81
Pipeline #3835 passed with stage
in 32 seconds
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.core.exceptions import ImproperlyConfigured
class LocalUserMiddleware(RemoteUserMiddleware):
This middleware can be used for developing Django projects in
environments where RemoteUserMiddleware is used in production
environments and a 1:1 mapping between local user accounts and
remote users exist.
:attention: Never use this middleware in production environments!
header = 'LOGNAME'
def __init__(self, *args, **kwargs):
super(LocalUserMiddleware, self).__init__(*args, **kwargs)
# Prevent accidental usage in production environments
if settings.DEBUG == False:
raise ImproperlyConfigured('The LocalUserMiddleware cannot be used in production environments!')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment