[Rt-devel] BUG/PATCH? RT::CurrentUser::LoadByEmail() should use $self->UserObj

Jim Meyer purp at acm.org
Thu Dec 15 17:13:24 EST 2005


Hello!

Here's the code:

sub LoadByEmail  {
    my $self = shift;
    my $identifier = shift;
                                                                                
    $identifier = 
        RT::User::CanonicalizeEmailAddress(undef, $identifier);
         
    $self->LoadByCol("EmailAddress",$identifier);
     
}


Rather than calling CanonicalizeEmailAddress statically, shouldn't it
call $self->UserObj->CanonicalizeEmailAddress? Are there cases where a
valid RT::CurrentUser object won't have a valid RT::User object?

As it stands, it forces any downstream functions to worry about whether
or not $self is defined as well as needlessly invalidating any use of
ACLs.

I offer the attached patch.

Cheers!

--j
-- 
Jim Meyer, Geek at Large                                    purp at acm.org
-------------- next part --------------
--- lib/RT/CurrentUser.pm	2005-06-08 23:36:24.000000000 -0700
+++ local/lib/RT/CurrentUser.pm	2005-12-15 14:07:46.000000000 -0800
@@ -213,9 +213,9 @@
 sub LoadByEmail  {
     my $self = shift;
     my $identifier = shift;
 
-    $identifier = RT::User::CanonicalizeEmailAddress(undef, $identifier);
+    $identifier = $self->UserObj->CanonicalizeEmailAddress($identifier);
         
     $self->LoadByCol("EmailAddress",$identifier);
     
 }


More information about the Rt-devel mailing list