Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
8c0f966c
Commit
8c0f966c
authored
Apr 14, 2021
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Security._setUserNameForAccessLog: Add support for WSGI Z2 log.
parent
622b2b80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
product/ERP5Security/__init__.py
product/ERP5Security/__init__.py
+12
-5
No files found.
product/ERP5Security/__init__.py
View file @
8c0f966c
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment