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

Kevin Falcone falcone at bestpractical.com
Thu Jul 29 17:04:53 EDT 2010


The branch, master has been updated
       via  6a493f40e6a0c4738e8863e174d1d390fa1b494c (commit)
      from  2e0a4b13e94588dfe0d699c8e42c2d6802866e09 (commit)

Summary of changes:
 lib/RT/Extension/LDAPImport.pm |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit 6a493f40e6a0c4738e8863e174d1d390fa1b494c
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Jul 29 17:06:45 2010 -0400

    Use the cache for shows too

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index 6ea2332..13b9cb5 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -814,17 +814,23 @@ sub _show_group_info {
     my $members = $self->_get_group_members_from_ldap(%args);
 
     my $ldap_members;
+    my $dnlist = $self->_dnlist;
     foreach my $member (@$members) {
-        my $ldap_users = $self->_run_search(
-            base   => $member,
-            filter => $RT::LDAPFilter,
-        );
-        unless ( $ldap_users && $ldap_users->count ) {
-            $self->_error("No user found for $member who should be a member of $group->{Name}");
-            next;
+        my $username;
+        if ($username = $dnlist->{$member}) {
+            $self->_debug("Found $username in cache for $member");
+        } else {
+            my $ldap_users = $self->_run_search(
+                base   => $member,
+                filter => $RT::LDAPFilter,
+            );
+            unless ( $ldap_users && $ldap_users->count ) {
+                $self->_error("No user found for $member who should be a member of $group->{Name}");
+                next;
+            }
+            my $ldap_user = $ldap_users->shift_entry;
+            my $username = $ldap_user->get_value($RT::LDAPMapping->{Name});
         }
-        my $ldap_user = $ldap_users->shift_entry;
-        my $username = $ldap_user->get_value($RT::LDAPMapping->{Name});
         $ldap_members->{$username}++;
     }
     my $rt_members;

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



More information about the Bps-public-commit mailing list