Our whole TWiki site is going to be authenticated, so I'll always have
$ENV{REMOTE_USER}
set.
In this case, TWikiRegistration fails to properly update the users list TWikiUsers but correctly creates the user topic from the wiki name.
I haven't fully understood what's going on, this is how far I got:
- Rather early in the bin/register process
TWiki::Users::findUser
is called with the login name (as from $ENV{REMOTE_USER}
) as $name
and an undefined $wikiname
.
-
TWiki::Users::findUser
tries to get the $wikiname
from its user cache and then from TWikiUsers, which all fails since the user is just about to register.
- At the end of
findUser
it says:
unless( $wikiname ) {
# default to wikiname being the same as name.
$this->{session}->writeWarning("$name does not exist in TWikiUsers - is this a bogus user?") unless( $name =~ /Group$/ );
$wikiname = $name;
}
return $this->_createUser( $name, $wikiname );
...hereby creating a user with explicitly having set
$wikiname
to
$name
.
- During
TWiki::UI::Register::finish
processing it does a _newUserFromTemplate
with the query data (including the correct $wikiname
)
- Then it calls
findUser
again, passing both $name
and $wikiname
.
-
findUser
however ignores $wikiname
if it finds an entry for $name
in the cache - which it has created itself in step 3.
- This cache entry still has
$wikiname
set to $name
, and this is how the entry is created in TWikiUsers.
If
/bin/register
doesn't get
$ENV{REMOTE_USER}
from Apache, then the first call to
TWiki::Users::findUser
returns the entry for
guest
instead of creating one for the login userid, and no problem occurs.
--
TWiki:Main.HaraldJoerg
I'll try to get time over the weekend to look at this.
--
MC
I put in what
should be a fix, but this needs confirmation from Harald that is does what is expected. Thanks Harald, for the excellent analysis above!
SVN 6770
CC
Sorry, took some time, I'm not at all familiar with subversion.... but eventually I managed to grab
lib/TWiki/UI/Register.pm
and
lib/TWiki/Users.pm
and applied the patches therein to my installation. It is sooo easy once you've found the link. And I can confirm: Yes, with your fix applied the registration is OK, and TWikiUsers looks fine as well. Thanks! --
TWiki:Main.HaraldJoerg