Commit 286af2cf authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Merge branch 'v2.0' into code-refactoring-v2

parents 92854c2f 0a4fabb4
Pipeline #10047 passed with stage
in 19 minutes and 37 seconds
......@@ -13,7 +13,7 @@ use JSON::XS;
#use AutoLoader qw(AUTOLOAD);
our $VERSION = '2.0.7';
our $VERSION = '2.0.10';
# Set here all the names of functions that must be available in Safe objects.
# Not that only functions, not methods, can be written here
......@@ -229,29 +229,22 @@ my $json = JSON::XS->new;
sub has2f {
my ( $session, $type ) = @_;
unless ( $session->{_2fDevices} ) {
return 0;
}
my $_2fDevices;
eval { $_2fDevices = $json->decode( $session->{_2fDevices} ); };
if ( $@ or ref($_2fDevices) ne "ARRAY" ) {
return 0;
}
return 0 unless ( $session->{_2fDevices} );
my $_2fDevices = eval { $json->decode( $session->{_2fDevices} ); };
return 0 if ( $@ or ref($_2fDevices) ne "ARRAY" );
my $length = scalar @{$_2fDevices};
# Empty array
if ( length @{$_2fDevices} == 0 ) {
return 0;
return 0 unless $length;
# Array has one value and we did not specify a type, succeed
}
elsif ( not $type ) {
return 1;
}
else {
if ($type) {
my @found = grep { lc( $_->{type} ) eq lc($type) } @{$_2fDevices};
return ( @found ? 1 : 0 );
}
return 0;
return 1;
}
1;
......@@ -11,11 +11,13 @@ use Lemonldap::NG::Common::Conf::ReConstants;
#use feature 'state';
extends 'Lemonldap::NG::Manager::Plugin',
'Lemonldap::NG::Common::Conf::AccessLib',
'Lemonldap::NG::Common::Session::REST';
extends qw(
Lemonldap::NG::Manager::Plugin
Lemonldap::NG::Common::Session::REST
Lemonldap::NG::Common::Conf::AccessLib
);
our $VERSION = '2.0.9';
our $VERSION = '2.0.10';
#############################
# I. INITIALIZATION METHODS #
......
package Lemonldap::NG::Manager::Api::Common;
our $VERSION = '2.0.9';
our $VERSION = '2.0.10';
package Lemonldap::NG::Manager::Api;
use strict;
use Lemonldap::NG::Manager::Build::Attributes;
use Lemonldap::NG::Manager::Build::CTrees;
......@@ -26,7 +27,7 @@ sub _getDefaultValues {
my $defaultAttrs = Lemonldap::NG::Manager::Build::Attributes::attributes();
my $attrs = {};
foreach $attr (@allAttrs) {
foreach my $attr (@allAttrs) {
$attrs->{$attr} = $defaultAttrs->{$attr}->{default}
if ( defined $defaultAttrs->{$attr}
&& defined $defaultAttrs->{$attr}->{default} );
......@@ -39,7 +40,7 @@ sub _hasAllowedAttributes {
my ( $self, $attributes, $rootNode ) = @_;
my @allowedAttributes = $self->_listAttributes($rootNode);
foreach $attribute ( keys %{$attributes} ) {
foreach my $attribute ( keys %{$attributes} ) {
if ( length( ref($attribute) ) ) {
return {
res => "ko",
......
package Lemonldap::NG::Manager::Conf::Tests;
use strict;
use utf8;
use strict;
use Lemonldap::NG::Common::Regexp;
......@@ -450,7 +451,7 @@ sub tests {
"RSA_SHA1" )
{
undef $allsha1;
break;
last;
}
}
}
......@@ -462,7 +463,7 @@ sub tests {
->{samlSPMetaDataOptionsSignatureMethod} ne "RSA_SHA1" )
{
undef $allsha1;
break;
last;
}
}
}
......@@ -866,8 +867,7 @@ sub tests {
$appUrl =~ m#^(https?://[^/]+)(/.*)?$#;
my $appHost = $1;
unless ($appHost) {
push @msg,
"$clientConfKey CAS Application has no Service URL";
push @msg, "$casConfKey CAS Application has no Service URL";
$res = 0;
next;
}
......
......@@ -8,7 +8,7 @@
# of lemonldap-ng.ini) and underlying handler configuration
package Lemonldap::NG::Portal::Main::Init;
our $VERSION = '2.0.9';
our $VERSION = '2.0.10';
package Lemonldap::NG::Portal::Main;
......@@ -239,9 +239,11 @@ sub reloadConf {
# Initialize templateDir
$self->{templateDir} =
$self->conf->{templateDir} . '/' . $self->conf->{portalSkin};
$self->conf->{templateDir} . '/' . $self->conf->{portalSkin}
if ( $self->conf->{templateDir} and $self->conf->{portalSkin} );
unless ( -d $self->{templateDir} ) {
$self->error("Template dir $self->{templateDir} doesn't exist");
$self->error("Template dir $self->{templateDir} doesn't exist")
if ref( $self->{templateDir} ) eq 'SCALAR';
return $self->fail;
}
$self->templateDir(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment