diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Request.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Request.pm index 4746ae511..84e032d2a 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Request.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Request.pm @@ -45,8 +45,8 @@ sub uri { $_[0]->{uri} } sub userData { my ( $self, $v ) = @_; - return $_[0]->{userData} = $v if ($v); - return $_[0]->{userData} || { _whatToTrace => $_[0]->user, }; + return $self->{userData} = $v if ($v); + return $self->{userData} || { _whatToTrace => $self->{user}, }; } sub respHeaders { diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm index c04728d78..c2100d51f 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm @@ -115,9 +115,12 @@ sub error_type { } sub init { - my ($self) = @_; + my ( $self, $conf ) = @_; $self->{$_} = {} foreach (qw(data customParameters sessionInfo pdata)); $self->{$_} = [] foreach (qw(respCookies)); + if ( my $tmp = $self->userData->{ $conf->{whatToTrace} } ) { + $self->user($tmp); + } } sub errorString { 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 e09c3255f..b4a7fbef7 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm @@ -38,7 +38,7 @@ sub handler { my ( $self, $req ) = @_; bless $req, 'Lemonldap::NG::Portal::Main::Request'; - $req->init(); + $req->init( $self->conf ); my $sp = 0; # Restore pdata