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

Kevin Falcone falcone at bestpractical.com
Wed Jul 28 18:35:22 EDT 2010


The branch, master has been updated
       via  229e26538d68f813fd378d159789010b5664c5d0 (commit)
       via  ce106fa8b1018c8d87654c82e1f01b5ff1bb83ed (commit)
       via  5de1f3102d62234b8a0182ab4f7057d8c18a4aff (commit)
       via  b09ab341f38fe290a8518e7111d75a876b829684 (commit)
       via  172861347e83950f475fcd3bf9f1711ba5c8ec07 (commit)
       via  e2779855c5f7882443a3c9c50be527d4c2262c45 (commit)
      from  63b87c54fbf1a4b13f954edac21e1d4ffdec53da (commit)

Summary of changes:
 bin/rtldapimport.in            |    4 ++--
 lib/RT/Extension/LDAPImport.pm |   24 ++++++++++++++++++------
 2 files changed, 20 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit e2779855c5f7882443a3c9c50be527d4c2262c45
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jul 28 18:06:56 2010 -0400

    fix missing pod

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index c924950..38f57e2 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -670,6 +670,16 @@ sub create_rt_group {
 
 }
 
+=head3 add_group_members
+
+Iterate over the list of DNs in the Member_Attr LDAP entry.
+Look up the appropriate username from LDAP.
+Add those users to the group.
+Remove members of the RT Group who are no longer members
+of the LDAP group.
+
+=cut
+
 sub add_group_members {
     my $self = shift;
     my %args = @_;

commit 172861347e83950f475fcd3bf9f1711ba5c8ec07
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jul 28 18:35:15 2010 -0400

    Call the right method
    
    We probably want this to be configurable not to import groups

diff --git a/bin/rtldapimport.in b/bin/rtldapimport.in
index 36519af..f669460 100755
--- a/bin/rtldapimport.in
+++ b/bin/rtldapimport.in
@@ -33,7 +33,7 @@ if ($import) {
     print "Starting import\n";
     $importer->import_users(import => 1);
     print "Starting group import\n";
-    $import->import_groups(import => 1);
+    $importer->import_groups(import => 1);
     print "Finished import\n";
 } else {
     print <<TESTING;
@@ -43,6 +43,6 @@ Rerun command with --debug for more information
 TESTING
     $importer->import_users;
     print "Testing group import\n";
-    $import->import_groups();
+    $importer->import_groups();
     print "Finished test\n";
 }

commit b09ab341f38fe290a8518e7111d75a876b829684
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jul 28 18:35:56 2010 -0400

    Fix a misleading warning

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index 38f57e2..4286644 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -110,7 +110,7 @@ sub _run_search {
         return;
     }
 
-    $self->_debug("search found ".$result->count." users");
+    $self->_debug("search found ".$result->count." objects");
     return $result;
 
 }

commit 5de1f3102d62234b8a0182ab4f7057d8c18a4aff
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jul 28 18:36:34 2010 -0400

    actually show the group name

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index 4286644..a36994d 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -684,6 +684,7 @@ sub add_group_members {
     my $self = shift;
     my %args = @_;
     my $group = $args{group};
+    my $groupname = $group->Name;
     my $ldap_entry = $args{ldap_entry};
 
     my $mapping = $RT::LDAPGroupMapping;
@@ -691,7 +692,7 @@ sub add_group_members {
     my $members = $ldap_entry->get_value($mapping->{Member_Attr}, asref => 1);
 
     unless (defined $members) {
-        $self->_warn("No members found for $group->{Name} in Member_Attr");
+        $self->_warn("No members found for $groupname in Member_Attr");
         return;
     }
 
@@ -701,7 +702,7 @@ sub add_group_members {
             filter => "(dn=$member)"
         );
         unless ( $ldap_users && $ldap_users->count ) {
-            $self->_warn("No user found for $member who should be a member of  ");
+            $self->_error("No user found for $member who should be a member of $groupname");
         }
         my $ldap_user = $ldap_users->shift_entry;
         my $username = $ldap_user->get_value($RT::LDAPMapping->{Name});
@@ -713,7 +714,7 @@ sub add_group_members {
         }
         ($res,$msg) = $group->AddMember($rt_user->PrincipalObj->Id);
         unless ($res) {
-            $self->_warn("Failed to add $username to $group->{Name}: $msg");
+            $self->_warn("Failed to add $username to $groupname: $msg");
         }
 
     }

commit ce106fa8b1018c8d87654c82e1f01b5ff1bb83ed
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jul 28 18:36:43 2010 -0400

    Since things can go horribly wrong, skip over DNs we can't find, but warn.

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index a36994d..c768d5e 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -703,6 +703,7 @@ sub add_group_members {
         );
         unless ( $ldap_users && $ldap_users->count ) {
             $self->_error("No user found for $member who should be a member of $groupname");
+            next;
         }
         my $ldap_user = $ldap_users->shift_entry;
         my $username = $ldap_user->get_value($RT::LDAPMapping->{Name});

commit 229e26538d68f813fd378d159789010b5664c5d0
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jul 28 18:37:03 2010 -0400

    When we have a DN, use it as the base

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index c768d5e..b6536ba 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -698,8 +698,8 @@ sub add_group_members {
 
     foreach my $member (@$members) {
         my $ldap_users = $self->_run_search(
-            base   => $RT::LDAPBase,
-            filter => "(dn=$member)"
+            base   => $member,
+            filter => $RT::LDAPFilter,
         );
         unless ( $ldap_users && $ldap_users->count ) {
             $self->_error("No user found for $member who should be a member of $groupname");

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



More information about the Bps-public-commit mailing list