[Bps-public-commit] RT-Extension-LDAPImport branch, master, updated. 0.32_04-3-ga49b380

Thomas Sibley trs at bestpractical.com
Thu May 24 12:59:23 EDT 2012


The branch, master has been updated
       via  a49b3801d02ec59d7f970b10a76dbf6fa203e043 (commit)
       via  b76bbf2217279f9daa502313d9eecc374225826c (commit)
      from  05f15db97932d4da80403a09ad02f7cc9d252cf6 (commit)

Summary of changes:
 lib/RT/Extension/LDAPImport.pm |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit b76bbf2217279f9daa502313d9eecc374225826c
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu May 24 11:36:58 2012 -0400

    Restore the old uncached group member search logic when Member_Attr_Value is DN
    
    Filtering on (dn=...) is invalid because DN isn't an attribute.
    Therefore if DN is what we need to search on, use the member's DN as the
    search base and the standard user filter.  Only if we're searching on an
    attribute do we now use the standard user base and an extended user
    filter.

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index c091b0a..59ce359 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -1080,10 +1080,14 @@ sub add_group_members {
         if (exists $users->{lc $member}) {
             next unless $username = $users->{lc $member};
         } else {
+            my $attr    = lc($RT::LDAPGroupMapping->{Member_Attr_Value} || 'dn');
+            my $base    = $attr eq 'dn' ? $member : $RT::LDAPBase;
+            my $filter  = $attr eq 'dn'
+                            ? $RT::LDAPFilter
+                            : "(&$RT::LDAPFilter($attr=" . escape_filter_value($member) . "))";
             my @results = $self->_run_search(
-                base   => $RT::LDAPBase,
-                filter => "(&$RT::LDAPFilter($RT::LDAPGroupMapping->{Member_Attr_Value}="
-                            . escape_filter_value($member) . "))"
+                base   => $base,
+                filter => $filter,
             );
             unless ( @results ) {
                 $users->{lc $member} = undef;

commit a49b3801d02ec59d7f970b10a76dbf6fa203e043
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu May 24 11:45:06 2012 -0400

    Ensure the users cache is defined before we use it

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index 59ce359..22b39ec 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -485,6 +485,8 @@ sub _cache_user {
     my %args = (@_);
     my $user = $args{user} || $self->_build_user_object( ldap_entry => $args{ldap_entry} );
 
+    $self->_users({}) if not defined $self->_users;
+
     my $group_map       = $RT::LDAPGroupMapping           || {};
     my $member_attr_val = $group_map->{Member_Attr_Value} || 'dn';
     my $membership_key  = lc $member_attr_val eq 'dn'

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list