[Rt-devel] Re: Who should call RT::EmailParser::LookupExternalUserInfo()?

Ruslan U. Zakirov cubic at acronis.ru
Thu Aug 26 06:27:13 EDT 2004


Petter Reinholdtsen wrote:
> [Petter Reinholdtsen]
> 
>>Which part of the code is supposed to call this function?  I suspect
>>Email/Auth/MailFrom.pm is the best place to insert the call.  Is this
>>patch on the right track?
> 
> 
> Digging deeper, I found User::CanonicalizeUserInfo() which could use a
> call to RT::EmailParser::LookupExternalUserInfo() as well, to make
> sure new users are created with the information updated from the
> external source.
> 
> Here is my proposed patch.
> 
> --- lib/RT/User_Overlay.pm.orig      2004-07-12 20:00:53.000000000 +0200
> +++ lib/RT/User_Overlay.pm    2004-08-26 12:14:27.000000000 +0200
> @@ -670,6 +670,15 @@
>      my $args = shift;
>      my $success = 1;
> 
> +    my %ExternalUserInfo =
> +    my ($UserFoundInExternalDatabase, %ExternalUserInfo) =
> +        RT::EmailParser::LookupExternalUserInfo( undef, $Address, $Name );
I think that RT::User object shouldn't call any sub from EmailParser 
namespace. LookupExternalUserInfo should be moved from mail parser code 
may be into User class or into new package that would contain helper 
functions for external users database handling.

Another reason why LookupExternalUserInfo should be moved from mail 
parser is that this function is general for all interfaces, web, mail or 
other doesn't matter.


					Best regards. Ruslan.


> +    if ($UserFoundInExternalDatabase) {
> +       for my $key (keys %ExternalUserInfo) {
> +           $userhashref->{$key} = $ExternalUserInfo{$key};
> +       }
> +    }
> +
>      return ($success);
>  }
> 
> Is this correct?  If it is, please include in a future version of RT.
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel



More information about the Rt-devel mailing list