You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/06/08 16:43:25 UTC

[1/2] incubator-trafficcontrol git commit: Add TO username to access log

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master e1a3fe500 -> f0b59cfa6


Add TO username to access log


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/541f08d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/541f08d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/541f08d0

Branch: refs/heads/master
Commit: 541f08d0ee0cdbe9d9110ac0ab5a7ce68573e9b4
Parents: e1a3fe5
Author: Robert Butts <ro...@gmail.com>
Authored: Mon Jun 5 10:12:54 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Thu Jun 8 09:32:47 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/TrafficOps.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/541f08d0/traffic_ops/app/lib/TrafficOps.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOps.pm b/traffic_ops/app/lib/TrafficOps.pm
index 89db9bf..7dfcb77 100644
--- a/traffic_ops/app/lib/TrafficOps.pm
+++ b/traffic_ops/app/lib/TrafficOps.pm
@@ -182,6 +182,17 @@ sub startup {
 		}
 	);
 
+	$self->hook(around_action => sub {
+		my ($next, $c, $action, $last) = @_;
+		my $user = $c->current_user();
+		my $username = '';
+		if ( defined($user) ) {
+			$username = $user->{username};
+		}
+		$c->set_username($username);
+		return $next->();
+	});
+
 	my $r = $self->routes;
 
 	# Look in the PERL5LIB for any TrafficOpsRoutes.pm files and load them as well
@@ -339,6 +350,7 @@ sub setup_mojo_plugins {
 	$self->plugin(
 		AccessLog => {
 			log    => "$logging_root_dir/access.log",
+			uname_helper => 'set_username',
 			format => '%h %l %u %t "%r" %>s %b %D "%{User-Agent}i"'
 		}
 	);


[2/2] incubator-trafficcontrol git commit: This closes #642

Posted by da...@apache.org.
This closes #642


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f0b59cfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f0b59cfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f0b59cfa

Branch: refs/heads/master
Commit: f0b59cfa6cf853b532735caf745b03e2cb66d8ee
Parents: 541f08d
Author: Dan Kirkwood <da...@gmail.com>
Authored: Thu Jun 8 10:42:33 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Thu Jun 8 10:42:33 2017 -0600

----------------------------------------------------------------------

----------------------------------------------------------------------