create new tag
, view all tags

Refactor Users Code

Strongly related: SimplifiedUserMappingCodeInterface, AddTWikiAdminUser, MergeFuncUsersContribWithFunc, CaseInsensitiveUserMapping


When CC was refactoring the TWiki codebase, he created a "User" object to provide a single point of reference for user identities. This was necessary because of the confusion over the use of usernames and wikinames, and the hard-coded user management approach.

Subsequently SvenDowideit refactored a large chunk of user management code out into the user mapping module. This allowed us to start developing external user mappers e.g. for LDAP.

A while ago, MichaelDaum was benchmarking and discovered that the user management API forced terrible inefficiencies on the user mapping code, due to the need to always create user objects for every user, on each TWiki page view. He proposed eliminating user objects altogether, and standardising on the wikiname as the means of referencing users.

CC subsequently redesigned the Func users API to adopt an iterator approach,which eliminates the need to always load all user objects. However the internal coding of the default TWikiUserMapping module is still forcing a full load.


CC has worked through the code eliminating all user objects, but without any recoding of the user mapping module. He has mailed this partial refactoring to SvenDowideit and MichaelDaum.

SvenDowideit then refactored the UserMapping system to AddTWikiAdminUser, and create a new SimplifiedUserMappingCodeInterface to facilitate the development of new UserMappings.

Next steps

TWikiUserMapping needs to be recoded to eliminate the requirement to load all user objects. This may entail some redesign of the internal API, which will of course impact on user mappings (such as LdapContrib). However it's better to do this now, and get it right, than it is to release with the current (partial) solution.

Further, this revised code needs to be tested for all outstanding bugs reported against users and groups (there are several).

IMHO this absolutely must be done before 4.2 is released. This refactoring will not result in any user-visible changes (though it should improve performance).

-- CrawfordCurrie - 27 Mar 2007


Update: I have eliminated the user object, and am running benchmarks.

-- CrawfordCurrie - 04 Apr 2007

Thanks Crawford for making the user related code cleaner!

-- PeterThoeny - 04 Apr 2007

As long as this code refactoring is not changing the existing API, or TML then this is not gated by the release process. And as I can see from the description this is not the case. So even though it was added to TWikiFeature04x02 it does not have to wait 14 days or release meeting decisions for any implementation - which seems to be what the Crawford thought also.

-- KennethLavrsen - 07 Apr 2007

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2007-06-28 - SvenDowideit
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.