[Bps-public-commit] RT-Extension-LDAPImport branch, master, updated. 0.33_02-1-g60058f9

Thomas Sibley trs at bestpractical.com
Thu Jan 31 14:22:26 EST 2013


The branch, master has been updated
       via  60058f98b051783919b8c214c4ae0a1ee796b5ad (commit)
      from  0306ad86a4307cc6f74ac0745338da4471f5eb42 (commit)

Summary of changes:
 lib/RT/Extension/LDAPImport.pm | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

- Log -----------------------------------------------------------------
commit 60058f98b051783919b8c214c4ae0a1ee796b5ad
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jan 31 09:36:31 2013 -0800

    Revert "use custom function instead of RT::Record->Update"
    
    This reverts commits 22b0995c834a6954c030eaee794277132a36c7b6 and
    dbdc867b7650a84a5b56dcab984f645ec776caac.
    
    RT::Authen::ExternalAuth is switching to ->Update as well, which lets us
    use ->Update here without the waffling problem described by 22b0995.
    Using more core code is better.

diff --git a/lib/RT/Extension/LDAPImport.pm b/lib/RT/Extension/LDAPImport.pm
index ee0c6f0..9b8121a 100644
--- a/lib/RT/Extension/LDAPImport.pm
+++ b/lib/RT/Extension/LDAPImport.pm
@@ -664,7 +664,7 @@ sub create_rt_user {
         if ($RT::LDAPUpdateUsers || $RT::LDAPUpdateOnly) {
             $self->_debug("$message, updating their data");
             if ($args{import}) {
-                my @results = $self->update_rt_user( user => $user_obj, info => $user );
+                my @results = $user_obj->Update( ARGSRef => $user, AttributesRef => [keys %$user] );
                 $self->_debug(join("\n", at results)||'no change');
             } else {
                 $self->_debug("Found existing user $user->{Name} to update");
@@ -701,33 +701,6 @@ sub create_rt_user {
 
 }
 
-=head2 update_rt_user
-
-Takes a hash with a user object as C<user> and a hashref of updated values as
-C<info>.  Mimics RT::Record's C<Update> method, but without side-effects of
-newline normalization.
-
-=cut
-
-sub update_rt_user {
-    my $self = shift;
-    my %args = @_;
-
-    my @results;
-    my $user = $args{'user'};
-    while ( my ($field, $new) = each %{ $args{'info'} } ) {
-        next unless defined $new;
-
-        my $old = $user->$field();
-        next if defined $old && $old eq $new;
-
-        my $method = "Set$field";
-        my ($status, $msg) = $user->$method( $new );
-        push @results, $user->loc('User [_1]: [_2]', $user->Name, $msg);
-    }
-    return @results;
-}
-
 sub _load_rt_user {
     my $self = shift;
     my %args = @_;

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



More information about the Bps-public-commit mailing list