|
|
@ -788,16 +788,18 @@ sub ldap2hashref { |
|
|
|
$want_single ||= []; |
|
|
|
$want_single ||= []; |
|
|
|
|
|
|
|
|
|
|
|
foreach my $entry ( $search->entries ) { |
|
|
|
foreach my $entry ( $search->entries ) { |
|
|
|
$return->{unidecode( lc $entry->get_value($key) )}->{dn} = $entry->dn; |
|
|
|
my $val = unidecode( lc $entry->get_value($key) ); |
|
|
|
|
|
|
|
# We don't want space here ! |
|
|
|
|
|
|
|
$val =~ s/\s+/-/g; |
|
|
|
|
|
|
|
$return->{$val}->{dn} = $entry->dn; |
|
|
|
foreach my $attr ( $entry->attributes ) { |
|
|
|
foreach my $attr ( $entry->attributes ) { |
|
|
|
my @values = $entry->get_value($attr); |
|
|
|
my @values = $entry->get_value($attr); |
|
|
|
if ( grep { $attr eq $_ } @{ $want_array } ) { |
|
|
|
if ( grep { $attr eq $_ } @{ $want_array } ) { |
|
|
|
$return->{unidecode( lc $entry->get_value($key) )}->{$attr} = \@values; |
|
|
|
$return->{$val}->{$attr} = \@values; |
|
|
|
} elsif ( grep { $attr eq $_ } @{ $want_single } ) { |
|
|
|
} elsif ( grep { $attr eq $_ } @{ $want_single } ) { |
|
|
|
$return->{unidecode( lc $entry->get_value($key) )}->{$attr} = $values[0]; |
|
|
|
$return->{$val}->{$attr} = $values[0]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$return->{unidecode( lc $entry->get_value($key) )}->{$attr} = ( scalar @values == 1 ) ? |
|
|
|
$return->{$val}->{$attr} = ( scalar @values == 1 ) ? $values[0] : \@values; |
|
|
|
$values[0] : \@values; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|