Test allowed select values (#19786)

This commit is contained in:
Christophe Maudoux 2021-01-24 12:41:41 +01:00
parent 3f1f5c880c
commit 54f41f10ea
2 changed files with 12 additions and 4 deletions

View File

@ -631,7 +631,7 @@ sub _dispatchAttributes {
sub _removeKeys {
my ( $self, $attrs, $hidden, $msg, $mask ) = @_;
my $regex = join '|', split /\s+/, $hidden;
my $regex = '^(?:' . join( '|', split( /\s+/, $hidden ) ) . ')';
my @keys = grep /$regex/, keys %$attrs;
$self->logger->debug($msg);

View File

@ -88,9 +88,17 @@ sub retreiveFindUserParams {
$self->logger->debug("FindUser: reading parameters...");
@$searching = map {
my $key = ( split '#', $_ )[0];
my $value = $req->params($key) // '';
if ( $value =~ /$self->{conf}->{findUserControl}/o ) {
my $regex = '\w+';
my $key = ( split '#', $_ )[0];
my $value = $req->params($key) // '';
my @values = split $self->conf->{multiValuesSeparator},
$self->conf->{findUserSearchingAttributes}->{$_} || '';
$regex = '^(?:' . join( '|', split( /\s+/, @values ) ) . ')$'
if scalar @values > 1;
if ( $value =~ /$regex/o
&& $value =~ /$self->{conf}->{findUserControl}/o )
{
$self->logger->debug("Push searching parameter: $key => $value");
{ key => $key, value => $value };
}