Question
I have setup Twiki to run on a test system and all is running smoothly. I have set-up NTLM authentication so that we can use our AD Domain usernames and passwords. All Twiki scripts require authentication.
Our Domain usernames are in the format
DOMAIN\Lastname Firstname i.e. there is a space in there. Because of this space it appears the authenticated usename does not get translated to the registered
WikiName. Therefore the user is seen as a guest. If I login as a user without spaces the WikiName is translated to the logged in username.
When registering a new user the Login Username field is populated with the authenticated users login i.e.
DOMAIN\Lastname Firstname.
Is there anyway to get around this problem or does the authenticated username to WikiName translation only work when there are no spaces in the authenticated username?
Thanks for your help in advance.
Environment
--
AndrewHenderson - 06 Apr 2005
Answer
You can try the following change to
lib/TWiki.pm,
sub userToWikiListInit, change indicated in red. Please note that this is not tested and is not part of the core code.
# Get all entries with two '-' characters on same line, i.e.
# 'WikiName - userid - date created'
@list = grep { /^\s*\* $regex{wikiWordRegex}\s*-\s*[^\-]*-/o } @list;
my $wUser;
my $lUser;
foreach( @list ) {
# Get the WikiName and userid, and build hashes in both directions
if( ( /^\s*\* ($regex{wikiWordRegex})\s*\-\s*([^\-]*).*/o ) && $2 ) {
$wUser = $1; # WikiName
$lUser = $2; # userid
$lUser =~ s/$securityFilter//go; # FIXME: Should filter in for security...
$userToWikiList{ $lUser } = $wUser;
$wikiToUserList{ $wUser } = $lUser;
}
}
Please let us know if this works.
--
PeterThoeny - 07 Apr 2005
In version 4.1.2 the file to change is:
lib/TWiki/Users/TWikiUserMapping.pm
at line: 288 where I've changed:
$text =~ s/^\s*\* ($TWiki::regex{webNameRegex}\.)?($TWiki::regex{wikiWordRegex})\s*(?:-\s*(\S+)\s*)?-.*$/$this->_cacheUser($1,$2,$3)/gome;
to:
$text =~ s/^\s*\* ($TWiki::regex{webNameRegex}\.)?($TWiki::regex{wikiWordRegex})\s*(?:-\s*([a-z-_ ]+)\s*)?-.*$/$this->_cacheUser($1,$2,$3)/gome;
to allow logins with a-z _ (underscore) and - (dash).
Surely there is a better way to rip everything up to ' -' (space dash), but I'm not virtuos with regexp
--
DanieleAntoniazzi - 03 May 2007