[Bps-public-commit] RT-Extension-LDAPImport branch, master, updated. 0.34-14-g5e47a0c

Alex Vandiver alexmv at bestpractical.com
Sat Feb 23 18:55:04 EST 2013


The branch, master has been updated
       via  5e47a0c39c8b600fc263a3d66ed9d91d2e772954 (commit)
       via  91b5a08f798d8f1bcc1029bf475dbb95724da5e4 (commit)
       via  70259d7d89b57adc410ff8888d9eba4941dba2a6 (commit)
       via  2a6f191776f79c9442c8389e8a118bd3bda008a2 (commit)
      from  3d8cf0aa1168d7d3a83b311d860575779449dc2e (commit)

Summary of changes:
 README                         |  7 +++++--
 lib/RT/Extension/LDAPImport.pm | 22 ++++++++++++----------
 2 files changed, 17 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit 2a6f191776f79c9442c8389e8a118bd3bda008a2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sat Feb 23 02:36:37 2013 -0500

    Give _import_user a more useful return value

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index 75c4a32..02ffa16 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -535,7 +535,7 @@ sub _import_user {
     $self->add_custom_field_value( %args );
     $self->update_object_custom_field_values( %args, object => $args{user} );
 
-    return 1;
+    return $args{user};
 }
 
 =head2 _cache_user ldap_entry => Net::LDAP::Entry, [user => { ... }]

commit 70259d7d89b57adc410ff8888d9eba4941dba2a6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sat Feb 23 02:35:26 2013 -0500

    Update POD to lie less; _import_user is called even without --import

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index 02ffa16..d7626bd 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -517,7 +517,8 @@ sub import_users {
 
 =head2 _import_user
 
-The user has run us with --import, so bring data in.
+We have found a user to attempt to import; returns the L<RT::User>
+object if it was found (or created), C<undef> if not.
 
 =cut
 

commit 91b5a08f798d8f1bcc1029bf475dbb95724da5e4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sat Feb 23 02:36:05 2013 -0500

    Push Name checking into _import_user, to tighten the import_users loop

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index d7626bd..b3612e0 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -500,14 +500,6 @@ sub import_users {
     my $done = 0; my $count = scalar @results;
     while (my $entry = shift @results) {
         my $user = $self->_build_user_object( ldap_entry => $entry );
-        unless ( $user->{Name} ) {
-            $self->_warn("No Name or Emailaddress for user, skipping ".Dumper $user);
-            next;
-        }
-        if ( $user->{Name} =~ /^[0-9]+$/) {
-            $self->_debug("Skipping user '$user->{Name}', as it is numeric");
-            next;
-        }
         $self->_import_user( user => $user, ldap_entry => $entry, import => $args{import} );
         $done++;
         $self->_debug("Imported $done/$count users");
@@ -526,6 +518,15 @@ sub _import_user {
     my $self = shift;
     my %args = @_;
 
+    unless ( $args{user}{Name} ) {
+        $self->_warn("No Name or Emailaddress for user, skipping ".Dumper($args{user}));
+        return;
+    }
+    if ( $args{user}{Name} =~ /^[0-9]+$/) {
+        $self->_debug("Skipping user '$args{user}{Name}', as it is numeric");
+        return;
+    }
+
     $self->_debug("Processing user $args{user}{Name}");
     $self->_cache_user( %args );
 

commit 5e47a0c39c8b600fc263a3d66ed9d91d2e772954
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sat Feb 23 18:54:23 2013 -0500

    Update README

diff --git a/README b/README
index 1c09920..9c4a993 100644
--- a/README
+++ b/README
@@ -116,7 +116,9 @@ CONFIGURATION
 
             result
                 Hash reference with results of completed mappings for this
-                ldap entry.
+                ldap entry. This should be used to inject that are not in
+                the mapping, not to inspect. Mapping is processed in literal
+                order of the keys.
 
         The keys in the mapping (i.e. the RT fields, the left hand side) may
         be a user custom field name prefixed with "UserCF.", for example
@@ -305,7 +307,8 @@ METHODS
     setting $LDAPCreatePrivileged to 1.
 
   _import_user
-    The user has run us with --import, so bring data in.
+    We have found a user to attempt to import; returns the RT::User object
+    if it was found (or created), "undef" if not.
 
   _cache_user ldap_entry => Net::LDAP::Entry, [user => { ... }]
     Adds the user to a global cache which is used when importing groups

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



More information about the Bps-public-commit mailing list