[rt-users] LDAP not updating RT data when LDAP data changes

Rob Walker rob at ladle.net
Wed Dec 27 14:46:21 EST 2006


I set up the LDAP overlay.  To be specific, I set up
LdapUserLocalOverlay from the wiki.  It is doing autocreate for our
users just fine.  It is also working ("username/password is incorrect")
when we set the user to "disabled" in LDAP.

However, when I change an attribute for the user (I am using City for my
test), RT doesn't update the city field in my database.

I turned up logging, and found the following in my log file:

 [Wed Dec 27 18:52:03 2006] [debug]: UPDATED user rwalker from LDAP
* (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:621)


I looked at that file.

My version now is a little bit different than the one which was first there.

The if statement at the end of the file now looks like this, pardon the
gratuitous line wraps):

         if ($disabled_users->count) {
             my $UserObj = RT::User->new($RT::SystemUser);
             $UserObj->Load($self->Name);
             my ($val, $message) = $UserObj->SetDisabled(1);

             $RT::Logger->info("DISABLED user " . $self->Name .
                               " per LDAP ($val, $message)\n");
             $msg = "User disabled";
         } else {
             # Update their info from LDAP
             my %args = (Name => $self->Name);
             $self->CanonicalizeUserInfo(\%args);

             foreach my $key (sort(keys(%args))) {
                 next unless $args{$key};
                 my $method = "Set$key";
                 $self->$method($args{$key});
                 $RT::Logger->debug("UPDATED user " . $self->Name . "\
from LDAP -- \$key is $key\n");
                 $RT::Logger->debug("UPDATED user " . $self->Name . "\
from LDAP -- \$args is $args{$key}\n");
             }

             $updated = 1;
             $RT::Logger->debug("UPDATED user " . $self->Name . " from\
LDAP\n");
             $msg = 'User updated';
         }


So I copied the debug statements into the foreach loop, and now my
debugs look like this (datestamps and other data elided):

[] [debug]: UPDATED user rwalker from LDAP -- $key is Address1
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myaddress
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is City
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is mycity
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is Country
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is mycountry
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is EmailAddress
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myemail
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is ExternalAuthId
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myid
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is ExternalContactInfoId
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is ldapgook
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is Gecos
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is mygecosfield
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is Name
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myname
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is Organization
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myorg
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is RealName
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myrealname
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is State
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is mystate
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is WorkPhone
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myphone
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP -- $key is Zip
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:618)
[] [debug]: UPDATED user rwalker from LDAP -- $args is myzip
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:619)
[] [debug]: UPDATED user rwalker from LDAP
 (/usr/local/share/request-tracker3.4/lib/RT/User_Local.pm:623)


After this is finished, the database shows the old information still in
the database.

I am not really sure where to look on this, line 616-617 is

my $method = "Set$key";
$self->$method($args{$key});


So I thought that there might be a function somewhere called SetCity .

~$ cd /usr/share/request-tracker3.4/
/usr/share/request-tracker3.4$ grep -rni SetCity *
lib/RT/User.pm:625:=head2 SetCity VALUE

After looking at that file, I wonder if my problem here is a problem
with DBIx::SearchBuilder ... ?

dpkg -l libdbix-searchbuilder-perl returns me 1.38-1 (We are running
Ubuntu Dapper Drake, would love to see an install guide for RT3.6 on
Dapper Drake!)

Thanks in advance for any ideas.

Rob



More information about the rt-users mailing list