Commits

Michael van Tellingen committed fc7cf47

Always add the is_impersonate attribute and set the real user as attribute

  • Participants
  • Parent commits f2a4c5d
  • Branches with-real-user

Comments (0)

Files changed (1)

File impersonate/middleware.py

 
 class ImpersonateMiddleware(object):
     def process_request(self, request):
+        request.user.is_impersonate = False
+
         if request.user.is_authenticated() and \
            '_impersonate' in request.session:
             new_user = request.session['_impersonate']
+            new_user.real_user = request.user
+
             if check_allow_for_user(request, new_user) and \
                check_allow_for_uri(request.path):
                 request.user = new_user