[rt-devel] SenderMustExistInExternalDatabase Broken in RT3?

Jeff Hoover jeff.hoover at infotechfl.com
Wed Apr 23 18:43:47 EDT 2003


At 10:22 AM 4/22/2003, Jeff Hoover wrote:
>OK, I see that the user is being created by CreateUser in 
>Interfaces/Email.pm.  Can someone tell me where this gets called from so I 
>can see if it is checking $SenderMustExistInExternalDatabase?
>
>Thanks in advance for any help!
>
>-- Jeff

Never mind.  I guess when nobody will help you, you have to figure things 
out on your own. I found where it was getting called from and fixed this 
problem.  I'm sure there is a better way, and it may not be bug proof, but 
this way worked for me:

1. Edit lib/RT/EmailParser.pm to allow

@EXPORT_OK   = qw(&LookupExternalUserInfo);

2. Edit lib/RT/Interface/Email/Auth/MailFrom.pm

25c25,27
< use RT::Interface::Email qw(ParseSenderAddressFromHead CreateUser);
---
 > use RT::Interface::Email qw(ParseSenderAddressFromHead CreateUser 
MailError);
 > use RT::EmailParser qw(&LookupExternalUserInfo);
 > use MIME::Entity;
39a42
 >     my $Username = undef;
40a44,80
 >
 >
 >     # Now we need to check in external database if set
 >     if ( $RT::LookupSenderInExternalDatabase ) {
 >
 >       my $parser = RT::EmailParser->new();
 >       ( $UserFoundInExternalDatabase, %UserInfo ) = 
$parser->LookupExternalUserInfo( $Address, $Name );
 >
 >       if ( $RT::SenderMustExistInExternalDatabase && 
!$UserFoundInExternalDatabase ) {
 >
 >           my $Message = "Sender's email address was not found in the 
user database.";
 >
 >             # {{{  This code useful only if you've defined an 
AutoRejectRequest template
 >
 >             require RT::Template;
 >             my $template = new RT::Template($RT::Nobody);
 >             $template->Load('AutoRejectRequest');
 >             $Message = $template->Content || $Message;
 >
 >             # }}}
 >
 >             MailError(
 >                  To      => $Address,
 >                  Subject => "Ticket Creation failed: user could not be 
created",
 >                  Explanation => $Message,
 >                  MIMEObj     => $entity,
 >                  LogLevel    => 'notice' );
 >
 >             return ($CurrentUser);
 >
 >       } else {
 >         $Address  = $UserInfo{'EmailAddress'};
 >         $Username = $UserInfo{'Name'};
 >       }
 >     }
 >
 >
121c161
<     $CurrentUser = CreateUser( undef, $Address, $Name, $args{'Message'} );
---
 >     $CurrentUser = CreateUser( $Username, $Address, $Name, 
$args{'Message'} );

-- Jeff




More information about the Rt-devel mailing list