TWiki::Attach::_expandAttrs() has the following lines:
elsif ( $attr eq 'USER' ) {
my $user = $info->{user} || 'UnknownUser';
my $cUID;
if( $user ) {
$cUID = $users->getCanonicalUserID( $user );
if (!$cUID) {
# Not a login name or a wiki name. Is it a valid cUID?
my $ln = $users->getLoginName($user);
$cUID = $user if defined $ln && $ln ne 'unknown';
}
}
This is not right because TWiki::Users::getCanonicalUserID($user) assumes $user is not a cUID while $user may.
If a cUID and the corresponding login name are different, it's not possible for the user mapping handler to have TWiki::Users::getCanonicalUserID($user) return $user.
You need to first assume $user is a cUID and then resort to wiki name.
In the spirit of this, TWiki::Render::renderRevisionInfo() has the following lines.
my $cUID = $users->getLoginName($user) ?
$user : $users->getCanonicalUserID( $user );
This does not consider the possibility of 'unknown' login name.
So the above should be:
my $ln = $users->getLoginName($user);
my $cUID = defined($ln) && $ln ne 'unknown' ?
$user : $users->getCanonicalUserID( $user );
This needs to be applied to TWiki::Attach::_expandAttrs().
--
TWiki:Main/HideyoImazu
- 2012-07-31