allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [1/2] allura git commit: [#8155] include user-agent in user audit logs too
Date Thu, 06 Jul 2017 15:07:34 GMT
Repository: allura
Updated Branches:
  refs/heads/master 48bdb3223 -> 71ee853a0


[#8155] include user-agent in user audit logs too


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/71ee853a
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/71ee853a
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/71ee853a

Branch: refs/heads/master
Commit: 71ee853a0950475f84741bcc2a942410bcc999cc
Parents: 1a1d8cd
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Jun 27 18:06:40 2017 -0400
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Thu Jul 6 14:54:06 2017 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py      | 2 +-
 Allura/allura/tests/decorators.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/71ee853a/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 181fdcd..ff5d361 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -1243,7 +1243,7 @@ def auditlog_user(message, *args, **kwargs):
     """
     from allura import model as M
     ip_address = utils.ip_address(request)
-    message = 'IP Address: {}\n'.format(ip_address) + message
+    message = 'IP Address: {}\nUser-Agent: {}\n'.format(ip_address, request.user_agent) +
message
     if c.user and kwargs.get('user') and kwargs['user'] != c.user:
         message = 'Done by user: {}\n'.format(c.user.username) + message
     return M.AuditLog.log_user(message, *args, **kwargs)

http://git-wip-us.apache.org/repos/asf/allura/blob/71ee853a/Allura/allura/tests/decorators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/decorators.py b/Allura/allura/tests/decorators.py
index e4e18ba..d54a6c2 100644
--- a/Allura/allura/tests/decorators.py
+++ b/Allura/allura/tests/decorators.py
@@ -167,7 +167,8 @@ def audits(*messages, **kwargs):
     if kwargs.get('user'):
         actor = kwargs.get('actor', '.*')
         ip_addr = kwargs.get('ip_addr', '.*')
-        preamble = '(Done by user: {}\n)?IP Address: {}\n'.format(actor, ip_addr)
+        user_agent = kwargs.get('user_agent', '.*')
+        preamble = '(Done by user: {}\n)?IP Address: {}\nUser-Agent: {}\n'.format(actor,
ip_addr, user_agent)
     else:
         preamble = ''
     for message in messages:


Mime
View raw message