• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5451: MailInContrib reveals error in Password.pm, that has been carried over to LdapContrib

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Urgent Closed   patch 4.2.1, 5.0.0

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


bash-3.2# ../tools/mailincron
constructed a new LdapContrib object
cacheAge=500, lastUpdate=1205799860, refresh=0
cacheAge=500, lastUpdate=1205799860, refresh=0
"my" variable $line masks earlier declaration in same scope at /Library/Perl/5.8.8/Net/IMAP/Simple.pm line 901.
Useless use of hash element in void context at /Library/Perl/5.8.8/Net/IMAP/Simple.pm line 903.
Can't locate object method "findLoginByEmail" via package "TWiki::Users::LdapUser" at /Library/WebServer/twiki/lib/TWiki/Users/TWikiUserMapping.pm line 679, <GEN0> line 1340.
 at /Library/WebServer/twiki/lib/TWiki/Contrib/MailInContrib.pm line 45
   TWiki::Contrib::MailInContrib::__ANON__('Can\'t locate object method "findLoginByEmail" via package "T...') called at /Library/WebServer/twiki/lib/TWiki/Users/TWikiUserMapping.pm line 679
   TWiki::Users::TWikiUserMapping::findUserByEmail('TWiki::Users::LdapUserMapping=HASH(0xa9fb3c)', 'sven@mini.home.org.au') called at /Library/WebServer/twiki/lib/TWiki/Users.pm line 435
   TWiki::Users::findUserByEmail('TWiki::Users=HASH(0x936a54)', 'sven@mini.home.org.au') called at /Library/WebServer/twiki/lib/TWiki/Contrib/MailInContrib.pm line 188
   TWiki::Contrib::MailInContrib::processInbox('TWiki::Contrib::MailInContrib=HASH(0x8f2810)', 'HASH(0x878b9c)') called at ../tools/mailincron line 58

bash-3.2# grep ByEmail /Library/WebServer/twiki/lib/TWiki/Users/*
/Library/WebServer/twiki/lib/TWiki/Users/HtPasswdUser.pm:sub findLoginByEmail {
/Library/WebServer/twiki/lib/TWiki/Users/LdapUser.pm:---++++ findUserByEmail( $email ) -> \@users
/Library/WebServer/twiki/lib/TWiki/Users/LdapUser.pm:sub findUserByEmail {
/Library/WebServer/twiki/lib/TWiki/Users/LdapUser.pm:  push @users, $this->{secondaryPasswordManager}->findUserByEmail(@_);
/Library/WebServer/twiki/lib/TWiki/Users/LdapUser.pm.bak:---++++ findUserByEmail( $email ) -> \@users
/Library/WebServer/twiki/lib/TWiki/Users/LdapUser.pm.bak:sub findUserByEmail {
/Library/WebServer/twiki/lib/TWiki/Users/LdapUser.pm.bak:  push @users, $this->{secondaryPasswordManager}->findUserByEmail(@_);
/Library/WebServer/twiki/lib/TWiki/Users/Password.pm:---++ ObjectMethod findLoginByEmail($email) -> \@users
/Library/WebServer/twiki/lib/TWiki/Users/Password.pm:sub findUserByEmail {
/Library/WebServer/twiki/lib/TWiki/Users/TWikiUserMapping.pm:---++ ObjectMethod findUserByEmail( $email ) -> \@users
/Library/WebServer/twiki/lib/TWiki/Users/TWikiUserMapping.pm:sub findUserByEmail {
/Library/WebServer/twiki/lib/TWiki/Users/TWikiUserMapping.pm:        my $logins = $this->{passwords}->findLoginByEmail( $email );

The active released and functioning code seems to use findLoginByEmail frustratingly, this function is new in 4.2.0, so perhaps we should let the findLoginByEmail sub name win frown even if its naf.

the options are:

  1. rename to use the more sensible name findUserByEmail
    • the downside is that we break any usermappings built and in use
    • the upside is that its a more consistent name (as its used in TWiki::User and the UserMappings, and that finding user by email is rare - I only stumbled across it when a client wanted to look at MailInContrib
  2. rename TWiki::Users::Password and TWiki::Users::LdapUser.pm to use findLoginByEmail
    • downside: inconsistent naming for functions leads to confusion
    • upside: simpler fix

I'm leaning towards 2 -

-- TWiki:Main/SvenDowideit - 18 Mar 2008

The current LdapContrib supports both 4.2 and 4.1 interfaces. So there is no problem to have both findUserByEmail and findLoginByEmail in the LdapUser class. That's the tragedy strategy I used in the LdapUserMapping as well. Both, LdapUser and LdapUserMapping are suppose to call the service functions in the LdapContrib object. Oh, urgs, while looking up the code needed to implement findUser/LoginByEmail I just found out that there is no such service in the LdapContrib class currently, i.e. theres a U2EMAILS cache but no EMAIL2U reverse of it...

-- TWiki:Main.MichaelDaum - 18 Mar 2008

In TWikirev:13278 HtPasswdUser::findUserByEmail has been renamed to HtPasswdUser::findLoginByEmail in an attempt to clarify the internal API.

This is a terminology issue that did not fully propagate to APIs.

We have:

  1. login names used to log in,
  2. wiki names used to display a user in a wiki and
  3. canonnical user ids (cUIDs)

Login names and wik inames were formerly been captured in a User object of its own (TWiki < 4.2) . It has been found out that creating objects for each user is a bad thing and thus cUIDs habe been invented. cUIDs are used in RCS revisions and must obey the restrictions incured by this kind of store. Login names can be everything, i.e. an url in OpenID. Well and wiki names are more of "display names", that is the visual representation of an online user. Most of the time this is a WikiWord pointing to the homepage in the Main web.

Crawford renamed findUserByEmail to findLoginByEmail because that would have been more in line with this terminology. A findUserByEmail formerly meant: "get me the user object that has got this email". As we don't have any user objects anymore, this meaning morphed to "get me the login names of all users that use this email address."

Lets look at the way this job has been done:

File findUserByEmail findLoginByEmail Comment
TWiki::Func DONE   call to Users::findUserByEmail
TWiki::UserMapping DONE   implementation of UserMapping::findUserByEmail
TWiki::Users DONE   call to UserMapping::findUserByEmail by own Users::findUserByEmail wrapper
TWiki::Users::HtPasswdUser   DONE implementation of a separate TWiki::Users::HtPasswdUser::findLoginByEmail
TWiki::Users::Password DONE DONE base class for all TWiki::Users::* classes, documented as findLoginByEmail implemented as findUserByEmail

There was no TWiki::Users::HtpasswdUser::find(Login|User)ByEmail= before TWiki-4.2. All TWiki::Users::* classes being derived from TWiki::Users::Password override findUserByEmail ... with the sole exception of HtpasswdUer.


  • good idea
  • done incomplete
  • renaming of findUserByEmail to findLoginByEmail does not pay off
  • if one had consistency with terminology in mind it should have been called findLoginNamesByEmail

Conclusion: lets rename TWiki::Users::HtPasswdUser::findLoginByEmail to TWiki::Users::HtPasswdUser::findUserByEmail again. That's consistent with the rest of the code and the minimal change that is needed to fix it. Fix documentation of TWiki::Users::Passwd::findUserByEmail.

-- TWiki:Main.MichaelDaum - 15 Apr 2008

This bug is not related to LdapContrib, not this time.

-- TWiki:Main.MichaelDaum - 15 Apr 2008

sweet. thanks for the analysis - I reported it as LdapContrib because I came across it when looking into Ldap and MailIn

will poke a stick at it later

-- TWiki:Main.SvenDowideit - 15 Apr 2008

Conclusion: lets rename TWiki::Users::HtPasswdUser::findLoginByEmail to TWiki::Users::HtPasswdUser::findUserByEmail again

Is this still the only step missing in closing this? Is Michael or Sven on this one?

-- TWiki:Main.KennethLavrsen - 30 Apr 2008

Hello. Simple question. Can we get this one closed?

-- TWiki:Main.KennethLavrsen - 02 Jun 2008

What a pain. It even is still called findUserByEmail in the TWiki::Users::Password base-class while all TWikiUserMapping related classes implement findLoginByEmail

-- TWiki:Main.MichaelDaum - 12 Jun 2008

Isn't the obvious fix to create a synonym, and document clearly the issues with the function naming?

-- TWiki:Main.CrawfordCurrie - 04 Jul 2008

I will take actions on this bug.

-- TWiki:Main.MichaelDaum - 07 Jul 2008

We are still counting on you to fix this Michael. Release date is comming near.

-- TWiki:Main.KennethLavrsen - 22 Jul 2008

a synonym isn't going to help for an API - that would mean there would be 2 methods that needs to be tested for and conditionally called by any clients of that API - rather a large level of yuck.

as the API rename was almost completely incomplete, I think we should just back out the incomplete rename, and use the much more common function name.

lets see what happens - committing.

-- TWiki:Main.SvenDowideit - 28 Jul 2008

Note to Sopan. This is the one you worked on Sunday. So you should focus on testing this fix instead now that you have the whole thing lined up.

Thanks for the fix Sven.

-- TWiki:Main.KennethLavrsen - 28 Jul 2008

Hi Kenneth/Sven/Michael - I had the same fix which Sven committed. The same idea which Michael described in the discussion above. Thanks Sven for committing this.

-- TWiki:Main.SopanShewale - 28 Jul 2008

Cleaned "WaitingFor" field.

-- TWiki:Main.GilmarSantosJr - 10 Aug 2008

Summary MailInContrib reveals error in Password.pm, that has been carried over to LdapContrib
ReportedBy TWiki:Main.SvenDowideit
Codebase 4.2.0, ~twiki4
SVN Range TWiki-5.0.0, Sun, 09 Mar 2008, build 16496
AppliesTo Engine

Priority Urgent
CurrentState Closed

Checkins TWikirev:17164 TWikirev:17165
TargetRelease patch
ReleasedIn 4.2.1, 5.0.0
Edit | Attach | Watch | Print version | History: r18 < r17 < r16 < r15 < r14 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r18 - 2008-08-10 - GilmarSantosJr
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback