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

Jim Meyer purp at acm.org
Fri Dec 16 14:28:19 EST 2005


Hello!

On Thu, 2005-12-15 at 14:14, Jesse Vincent wrote:
> > call $self->UserObj->CanonicalizeEmailAddress? Are there cases where a
> > valid RT::CurrentUser object won't have a valid RT::User object?
> 
> Yes. When you first load it.

Right. At that point it's a valid (though empty) user object, still
suitable for calling methods and arguably better than calling methods
statically as those methods can now know that you are unsure of who's
doing the calling.

On Thu, 2005-12-15 at 14:38, Ruslan Zakirov wrote: 
> I think RT::User->CanonicalizeEmailAddress($identifier); variant is better.

I'd like to hear more of why you feel so because, at present, I don't
agree. It means that CanonicalizeEmailAddress (and any function which
might be called by it) must support being called without a valid user.
Alternately, CanonicalizeEmailAddress could choose to create an empty
user object (which is what I'm doing at present), but then we've broken
the chain connecting the user who's acting and the actions being taken.
This also makes this function an exception within the RT::User object.

If I seem to advocate strongly for this change, it's because the
required change seems very straightforward and makes the RT::User object
wholly consistent in this regard.

Cheers!

--j

p.s. This would also require a similar change to two lines in
RT::Ticket::_RecordNote, where it would call
$self->CurrentUser->UserObj->CanonicalizeEmailAddress().
-- 
Jim Meyer, Geek at Large                                    purp at acm.org



More information about the Rt-devel mailing list