Append conf test & REST init test & set default values (#2176)

v2.11
Christophe Maudoux 4 years ago
parent a76bf37c29
commit d14fae87ce
  1. 4
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm
  2. 4
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm
  3. 4
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm
  4. 15
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm
  5. 2
      lemonldap-ng-manager/site/htdocs/static/struct.json
  6. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/REST.pm

@ -83,8 +83,8 @@ sub defaultValues {
'facebookExportedVars' => {},
'facebookUserField' => 'id',
'failedLoginNumber' => 5,
'findUserControl' => '^[\\w]+$',
'findUserWildcard' => '',
'findUserControl' => '^[*\\w]+$',
'findUserWildcard' => '*',
'formTimeout' => 120,
'githubAuthnLevel' => 1,
'githubScope' => 'user:email',

@ -1365,7 +1365,7 @@ qr/^(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-
'type' => 'bool'
},
'findUserControl' => {
'default' => '^[\\w]+$',
'default' => '^[*\\w]+$',
'type' => 'pcre'
},
'findUserExcludingAttributes' => {
@ -1377,7 +1377,7 @@ qr/^(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-
'type' => 'keyTextContainer'
},
'findUserWildcard' => {
'default' => '',
'default' => '*',
'type' => 'text'
},
'forceGlobalStorageIssuerOTT' => {

@ -546,12 +546,12 @@ sub attributes {
},
findUserWildcard => {
type => 'text',
default => '',
default => '*',
documentation => 'Character used as wildcard',
},
findUserControl => {
type => 'pcre',
default => '^[\w]+$',
default => '^[*\w]+$',
documentation => 'Regular expression to validate parameters',
},
globalLogoutRule => {

@ -953,12 +953,25 @@ sub tests {
return 1;
},
# FindUser wildcard must be allowed
findUserWildcard => sub {
return 1
unless ( $conf->{findUser}
and $conf->{findUserWildcard}
and $conf->{findUserControl} );
return ( 1,
'FindUser wildcard should be allowed by parameters control' )
unless (
$conf->{findUserWildcard} =~ /$conf->{findUserControl}/o );
return 1;
},
# AuthChoice parameters must exist
AuthChoiceParams => sub {
return 1 unless %{ $conf->{authChoiceModules} };
foreach (qw(AuthBasic FindUser)) {
if ( $conf->{"authChoice$_"} ) {
my $test = $conf->{"authChoice$_"};
my $test = $conf->{"authChoice$_"};
my $param = grep /^$test$/,
keys %{ $conf->{authChoiceModules} };
return ( -1, "Choice $_ parameter does not exist" )

File diff suppressed because one or more lines are too long

@ -24,7 +24,11 @@ sub init {
# Add warning in log
unless ( $self->conf->{restUserDBUrl} ) {
$self->logger->error('No User REST URL given');
$self->logger->error('User REST URL ids not set');
return 0;
}
if ( !$self->conf->{restFindUserDBUrl} && $self->conf->{findUser} ) {
$self->logger->error('findUser REST URL is not set');
return 0;
}
return 1;

Loading…
Cancel
Save