changes for adding ldap recursive filter

This commit is contained in:
Frank Dillon 2006-07-12 20:31:02 +00:00
parent 45b5d6ea5b
commit ec4245a7d8
2 changed files with 24 additions and 2 deletions

View file

@ -753,6 +753,7 @@ sub getLDAPUsers {
my $ldapGroup = $self->get("ldapGroup");
my $ldapGroupProperty = $self->get("ldapGroupProperty");
my $ldapRecursiveProperty = $self->get("ldapRecursiveProperty");
my $ldapRecurseFilter = $self->get("ldapRecursiveFilter");
return [] unless ($ldapLinkId && $ldapGroup && $ldapGroupProperty);
@ -764,7 +765,7 @@ sub getLDAPUsers {
my $people = [];
if($ldapRecursiveProperty) {
$ldapLink->recurseProperty($ldapGroup,$people,$ldapGroupProperty,$ldapRecursiveProperty);
$ldapLink->recurseProperty($ldapGroup,$people,$ldapGroupProperty,$ldapRecursiveProperty,$ldapRecurseFilter);
} else {
$people = $ldapLink->getProperty($ldapGroup,$ldapGroupProperty);
}
@ -1184,7 +1185,26 @@ sub ldapRecursiveProperty {
return $self->get("ldapRecursiveProperty");
}
#-------------------------------------------------------------------
=head2 ldapRecursiveFilter ( [ value ] )
Returns the ldap group recursive filter used to filter out entries that aren't groups from the groups of groups attribute.
=head3 value
If specified, the ldapRecursiveFilter is set to this value.
=cut
sub ldapRecursiveFilter {
my $self = shift;
my $value = shift;
if (defined $value) {
$self->set("ldapRecursiveFilter",$value);
}
return $self->get("ldapRecursiveFilter");
}
#-------------------------------------------------------------------

View file

@ -267,6 +267,7 @@ sub recurseProperty {
my $property = $_[2];
my $recProperty = $_[3] || $property;
my $count = $_[4] || 0;
my $recurseFilter = $_[5] || $self->get->{globalRecursiveFilter};
return unless($ldap && $base && $property);
#Prevent infinate recursion
@ -293,7 +294,8 @@ sub recurseProperty {
$properties = $entry->get_value($recProperty,asref => 1);
}
foreach my $prop (@{$properties}) {
$self->recurseProperty($prop,$array,$property,$recProperty,$count);
next if ($recurseFilter && $prop =~ m/$recurseFilter/ig);
$self->recurseProperty($prop,$array,$property,$recProperty,$count,$recurseFilter);
}
}
}