Refactor Users Code
Strongly related:
SimplifiedUserMappingCodeInterface,
AddTWikiAdminUser,
MergeFuncUsersContribWithFunc,
CaseInsensitiveUserMapping
Background
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.
Status
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
Discussion
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