• 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.

Item6909: TWiki::Attach::_expandAttrs() yields incorrect value for 'USER' when you use a custom user mapping handler

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal Closed   major 6.0.0

Edit Form Data

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


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

Summary TWiki::Attach::_expandAttrs() yields incorrect value for 'USER' when you use a custom user mapping handler
ReportedBy TWiki:Main.HideyoImazu
Codebase ~twiki4, 5.1.1, 5.1.0, 5.0.2, 5.0.1, 5.0.0
SVN Range TWiki-5.1.1-trunk, Fri, 27 Jul 2012, build 23097
AppliesTo Engine

Priority Normal
CurrentState Closed

Checkins TWikirev:23110
TargetRelease major
ReleasedIn 6.0.0
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r5 - 2013-10-15 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback