From b79c9659cb4cc0de8591b375ec460c63cc631279 Mon Sep 17 00:00:00 2001 From: Antoine ROSIER Date: Wed, 27 Mar 2019 16:00:39 +0100 Subject: [PATCH] Add user logs informations (#1687) --- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm | 3 ++- .../lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm index 4e0883b43..c5f5ba44a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm @@ -560,7 +560,8 @@ sub _deleteSession { # Log my $user = $req->{sessionInfo}->{ $self->conf->{whatToTrace} }; - $self->userLogger->notice("User $user has been disconnected") if $user; + my $mod = $req->{sessionInfo}->{_auth}; + $self->userLogger->notice("User $user has been disconnected from $mod"." (".$req->{sessionInfo}->{ipAddr}.")") if $user; return $session->error ? 0 : 1; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm index 459f21057..c816f5fa5 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm @@ -92,6 +92,11 @@ sub run { } } } + + # Log + my $user = $req->{sessionInfo}->{ $self->conf->{whatToTrace} }; + my $mod = $req->{sessionInfo}->{_auth}; + $self->userLogger->notice("Session granted for $user by $mod"." (".$req->{sessionInfo}->{ipAddr}.")") if ($user); return PE_OK; }