Skip bad rule & improve unit test (#2102)
This commit is contained in:
parent
18b43cacfc
commit
9a6b604f5c
|
@ -7,7 +7,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
PE_OK
|
||||
);
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
our $VERSION = '2.0.8';
|
||||
|
||||
extends 'Lemonldap::NG::Portal::Main::Plugin';
|
||||
|
||||
|
@ -27,9 +27,13 @@ sub init {
|
|||
my $sub =
|
||||
$safe->reval( 'sub{my($env)=@_;return (' . $rules->{$id} . ')}' );
|
||||
if ($@) {
|
||||
$self->error( 'Bad Autologin rule "' . $rules->{$id} . ': $@' );
|
||||
return 0;
|
||||
$self->logger->error(
|
||||
'Bad Autologin rule "' . $rules->{$id} . ": $@" );
|
||||
$self->logger->debug(
|
||||
"Skipping Autologin rule for user \"$id\"");
|
||||
next;
|
||||
}
|
||||
$self->logger->debug("Autologin rule for user \"$id\" appended");
|
||||
$id =~ s/^\s*([\w\-\@]+)\s*/$1/;
|
||||
push @{ $self->rules }, [ $sub, $id ];
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@ my $client = LLNG::Manager::Test->new( {
|
|||
authentication => 'Demo',
|
||||
userDB => 'Same',
|
||||
autoSigninRules => {
|
||||
dwho => '$env->{REMOTE_ADDR} =~ /^127/',
|
||||
rtyler => '$env->{REMOTE_ADDR} =~ /^127',
|
||||
dwho => '$env->{REMOTE_ADDR =~ /^127/',
|
||||
msmith => '$env->{REMOTE_ADDR} =~ /^127/',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue