Replacing WebExternalAuthInfo in 3.0.11


#1

Greets.

I’m a new RT user and have been digging into the docs and code. Great
stuff online in the wiki.

Our RT instance picks up REMOTE_USER from apache and auto creates a new
account as needed.

I am trying to replaced the WebExternalAutoInfo method found in Web.pm
with one that will map LDAP attribs from our corporate directory to the
accounts created in RT. I’m doing so by creating Web_Local.pm with my
own WebExternalAutoInfo defined. I place the Web_Local.pm file in the
same directory as the Web.pm file and have verified that Web.pm
correctly finds and loads Web_Local.pm after RT is restarted.

I know WebExternalAutoInfo in Web.pm is called when a new user is
created because of the RT::Logger->debug statement I added to verify RT
calls it. This tells me my RT_SiteConfig is correct.

What fails is the WebExternalAutoInfo method in Web_Local.pm does not
override the previously defined WebExternalAutoInfo method in Web.pm.

Taking a look at the included Web_Local.pm can anyone give me hints as
to why my WebExternalAutoInfo method isn’t being called by RT?

Thanks much.

no warnings qw(redefine);
use strict;

=head2 WebExternalAutoInfo($user);

Returns a hash of user attributes, used when WebExternalAuto is set.

=cut

{{{ sub WebExternalAuthInfo

sub WebExternalAutoInfo {
my $user = shift;
my %user_info;

     $user_info{'Privileged'} = 1;

     # some debug where real code will some day go
     $user_info{'RealName'} = "John Doe";
     $RT::Logger->debug("Gather info for $user");

     return {%user_info};

}

}}}

1;

Scott Russell lnxgeek@us.ibm.com
IBM Linux Technology Center


#2

I didn’t see this in the top of your file:

package RT::Interface::Web;

Without it, I think your new subroutine is in the wrong namespace.

bobg


#3

Bob Goldstein wrote:

I didn’t see this in the top of your file:

package RT::Interface::Web;

Without it, I think your new subroutine is in the wrong namespace.

Yeah, that solved it. Since Web_Local.pm was evaled from Web.pm I didn’t
think I needed this. I’m going to have go brush up on my OO perl.

Thanks much.

Scott Russell lnxgeek@us.ibm.com
IBM Linux Technology Center