Commit 8c0f966c authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Security._setUserNameForAccessLog: Add support for WSGI Z2 log.

parent 622b2b80
Pipeline #19462 failed with stage
in 0 seconds
...@@ -63,13 +63,20 @@ def _setUserNameForAccessLog(username, REQUEST): ...@@ -63,13 +63,20 @@ def _setUserNameForAccessLog(username, REQUEST):
""" """
# Set the authorization header in the medusa http request # Set the authorization header in the medusa http request
# so that the username can be logged to the Z2.log # so that the username can be logged to the Z2.log
# Put the full-arm latex glove on now...
try: try:
# Put the full-arm latex glove on now... # Is this WSGI ?
medusa_headers = REQUEST.RESPONSE.stdout._request._header_cache REQUEST._orig_env['wsgi.input']
except AttributeError: except KeyError:
pass # Not WSGI, maybe Medusa
try:
medusa_headers = REQUEST.RESPONSE.stdout._request._header_cache
except AttributeError:
pass
else:
medusa_headers['authorization'] = 'Basic %s' % encodestring('%s:' % username).rstrip()
else: else:
medusa_headers['authorization'] = 'Basic %s' % encodestring('%s:' % username).rstrip() REQUEST._orig_env['REMOTE_USER'] = username
def initialize(context): def initialize(context):
......
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