diff --git a/TODO-2.0.md b/TODO-2.0.md index e7d5ed315..10cbecfad 100644 --- a/TODO-2.0.md +++ b/TODO-2.0.md @@ -19,6 +19,11 @@ * Add test for #173 * lwpSslOpt +# Combination + +* getDisplayType() +* detect changes + # Password * Enable it during auth diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm index 2669c4978..f30a65b43 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm @@ -275,6 +275,27 @@ sub tests { # Return return 1; }, + checkCombinations => sub { + return 1 unless ( $conf->{authentication} eq 'Combination' ); + require Lemonldap::NG::Common::Combination::Parser; + return ( 0, 'No module declared for combination' ) + unless ( $conf->{combModules} and %{ $conf->{combModules} } ); + my $moduleList; + foreach my $md ( keys %{ $conf->{combModules} } ) { + my $entry = $conf->{combModules}->{$md}; + $moduleList->{$md} = ( + $entry->{for} == 2 ? [ undef, {} ] + : $entry->{for} == 1 ? [ {}, undef ] + : [ {}, {} ] + ); + } + eval { + Lemonldap::NG::Common::Combination::Parser->parse( $moduleList, + $conf->{combination} ); + }; + return ( 0, $@ ) if ($@); + return 1; + }, }; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Combination.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Combination.pm index 8cb832308..55b0de0a6 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Combination.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Combination.pm @@ -111,7 +111,10 @@ sub setGroups { } sub getDisplayType { - return $_[0]->try( 0, 'getDisplayType', {} ); + my ( $self, $req ) = @_; + my ( $nb, $stack ) = ( $req->datas->{multiTry}, $req->datas->{multiStack} ); + my ( $res, $name ) = $stack->[$nb]->[0]->( 'getDisplayType', $req ); + return $res; } # TODO: authLogout diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm index 153956d7b..786f97fe8 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm @@ -251,7 +251,7 @@ sub display { } - # Display authentifcation form + # Display authentication form else { # Authentication loop