[Bps-public-commit] RT-Extension-LDAPImport branch, master, updated. 0.20_01-40-g7bba76d

Alex Vandiver alexmv at bestpractical.com
Fri Jul 30 12:28:31 EDT 2010


The branch, master has been updated
       via  7bba76d6512613d52957b894e650c28f7ab1faa5 (commit)
       via  8c600d07afe03950b0c16f61fa8fd2ec4917aafe (commit)
      from  6a493f40e6a0c4738e8863e174d1d390fa1b494c (commit)

Summary of changes:
 lib/RT/Extension/LDAPImport.pm |   20 ++++++++++++++++----
 t/user-import.t                |    2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 8c600d07afe03950b0c16f61fa8fd2ec4917aafe
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jul 30 12:23:12 2010 -0400

    Fix case, so it works on case-sensitive databases

diff --git a/t/user-import.t b/t/user-import.t
index ec7ca09..7c0f653 100644
--- a/t/user-import.t
+++ b/t/user-import.t
@@ -47,7 +47,7 @@ $importer->screendebug(1) if ($ENV{TEST_VERBOSE});
 ok($importer->import_users());
 {
     my $users = RT::Users->new($RT::SystemUser);
-    for my $username (qw/RT_SYSTEM root Nobody/) {
+    for my $username (qw/RT_System root Nobody/) {
         $users->Limit( FIELD => 'Name', OPERATOR => '!=', VALUE => $username, ENTRYAGGREGATOR => 'AND' );
     }
     is($users->Count,0);

commit 7bba76d6512613d52957b894e650c28f7ab1faa5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jul 30 12:30:26 2010 -0400

    Add a negative cache as well

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index 13b9cb5..febb4dc 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -708,14 +708,20 @@ sub add_group_members {
     my $dnlist = $self->_dnlist;
     foreach my $member (@$members) {
         my $username;
-        if ($username = $dnlist->{$member}) {
-            $self->_debug("Found $username in cache for $member");
+        if (exists $dnlist->{$member}) {
+            if ($username = $dnlist->{$member}) {
+                $self->_debug("Found $username in cache for $member");
+            } else {
+                $self->_debug("Negative cache in cache for $member");
+                next;
+            }
         } else {
             my $ldap_users = $self->_run_search(
                 base   => $member,
                 filter => $RT::LDAPFilter,
             );
             unless ( $ldap_users && $ldap_users->count ) {
+                $dnlist->{$member} = undef;
                 $self->_error("No user found for $member who should be a member of $groupname");
                 next;
             }
@@ -817,14 +823,20 @@ sub _show_group_info {
     my $dnlist = $self->_dnlist;
     foreach my $member (@$members) {
         my $username;
-        if ($username = $dnlist->{$member}) {
-            $self->_debug("Found $username in cache for $member");
+        if (exists $dnlist->{$member}) {
+            if ($username = $dnlist->{$member}) {
+                $self->_debug("Found $username in cache for $member");
+            } else {
+                $self->_debug("Negative cache in cache for $member");
+                next;
+            }
         } else {
             my $ldap_users = $self->_run_search(
                 base   => $member,
                 filter => $RT::LDAPFilter,
             );
             unless ( $ldap_users && $ldap_users->count ) {
+                $dnlist->{$member} = undef;
                 $self->_error("No user found for $member who should be a member of $group->{Name}");
                 next;
             }

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



More information about the Bps-public-commit mailing list