From b2bcb4dcb9fd4d7415906d349dfe507048b8ab22 Mon Sep 17 00:00:00 2001 From: Maxime Besson Date: Thu, 7 Oct 2021 22:01:08 +0200 Subject: [PATCH] Transmit handler local config to handler psgi server init (#2632) --- lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/PSGI.pm | 6 +++--- lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI.pm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/PSGI.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/PSGI.pm index e41e2ef77..9fcc0fc8c 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/PSGI.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/PSGI.pm @@ -16,12 +16,12 @@ has api => ( is => 'rw', isa => 'Str' ); sub init { my ( $self, $args ) = @_; eval { $self->api->init($args) }; - if ( $@ and not( $self->{protection} and $self->{protection} eq 'none' ) ) { + if ( $@ and not( $args->{protection} and $args->{protection} eq 'none' ) ) { $self->error($@); return 0; } unless ( $self->api->checkConf($self) - or ( $self->{protection} and $self->{protection} eq 'none' ) ) + or ( $args->{protection} and $args->{protection} eq 'none' ) ) { $self->error( "Unable to protect this server ($Lemonldap::NG::Common::Conf::msg)" @@ -30,7 +30,7 @@ sub init { } eval { $self->portal( $self->api->tsv->{portal}->() ) }; my $rule = - $self->{protection} || $self->api->localConfig->{protection} || ''; + $args->{protection} || $self->api->localConfig->{protection} || ''; $self->rule( $rule eq 'authenticate' ? 1 : $rule eq 'manager' ? '' : $rule ); return 1; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI.pm index a457d7b7f..8d21c65a2 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI.pm @@ -14,9 +14,9 @@ our $VERSION = '2.0.10'; sub init { my ( $self, $args ) = @_; $self->api('Lemonldap::NG::Handler::PSGI::Main') unless ( $self->api ); - my $tmp = ( $self->Lemonldap::NG::Common::PSGI::init($args) - and $self->Lemonldap::NG::Handler::Lib::PSGI::init($args) ); - return $tmp; + return 0 unless $self->Lemonldap::NG::Handler::Lib::PSGI::init($args); + + return $self->Lemonldap::NG::Common::PSGI::init( $self->api->localConfig ); } 1;