This configuration:
$TWiki::cfg{UserMappingManager} = 'TWiki::Users::TWikiUserMapping';
$TWiki::cfg{Register}{EnableNewUserRegistration} = 1;
$TWiki::cfg{Register}{AllowLoginName} = 1;
$TWiki::cfg{PasswordManager} = 'TWiki::Users::LdapUser';
is intended to allow people to login via LDAP and to have user registration in TWiki where people have their profile pages. At the time of registration they can set their WikiName and login name, and TWiki keeps track of mapping from login name to WikiName based on the Main.TWikiUsers topic.
The login/password/usermapping managers interactions are overly complex in TWiki. Above configuration does not work because the password manager asks the TWiki::Users::TWikiUserMapping manager if it can handle the user (via call to handlesUser). This fails because the user is not yet registered. Because 0 is returned, the TWiki::Users::BaseUserMapping manager is used, which results in users not being able to login via LDAP, even though the cache.db file has all users cached properly.
Fix:
--- lib/TWiki/Users/TWikiUserMapping.pm (revision 18394)
+++ lib/TWiki/Users/TWikiUserMapping.pm (working copy)
@@ -158,6 +158,10 @@
# Check the login id to see if we know it
return 1 if ($login && $this->_userReallyExists( $login ));
+ # FIXME: Hack to make PasswordManager 'TWiki::Users::LdapUser' work with
+ # UserMappingManager 'TWiki::Users::TWikiUserMapping'
+ return 1 if ( $TWiki::cfg{PasswordManager} eq 'TWiki::Users::LdapUser' );
+
# Or the wiki name
if ($wikiname) {
_loadMapping($this); # Sorry Sven, has to be done
--
TWiki:Main/PeterThoeny
- 01 Apr 2010
This is now in SVN trunk and 4.3 branch, as well as package
TWiki:Plugins/TWikiUserMapping
--
TWiki:Main.PeterThoeny
- 02 Apr 2010