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

Several of us who have implemented alternate login management have encountered the same problem viz. the TWiki core code assumes that groups can be fully loaded, so it can do its own membership test. This is really a hangover from file-based users/groups, and needs to be sorted once and for all. The API needs to allow a user mapping manager to provide a group membership test. I had a chance to fix it when I abstracted the password managers. Sven then had a chance to abstract it when he did the user mapping code. Both of us missed the ball. frown

need at least:

TWiki::User::isMemberOf($group) -> $boolean

TWiki::User::getGroups() -> \@listOfGroup

These methods also need to be exported to the TWiki::Func API.

I am marking this as an enhancement to avoid making it a release blocker, though arguably it should be a requirement.


This is very far-reaching. For example, all functions in User.pm, and as a consequence in TWikiUserMapping.pm, need User objects to do their check. These are created using findUser() or expandUserList(). In the situations under consideration (e.g. in TWiki::Access.pm) you can get along by only using the WikiNames instead of full fledged perl objects.

So (a) one should not create so many User objects and (b) one should omit to create User objects at all and only use their WikiNames if possible.

One example of a heavy weight function is groupMembers() which returns a list of User objects that are used to check if the current user is a member of it. The final check is a simple call to equal() to see if the two names are equal. This function in itself requires two User objects to do the comparison. Overkill.

What would be enuf is a groupMemberNames() that simply returns the names of the group members instead. As groups can be nested the check isGroup, which also is an ObjectMethod, needs to be able to perform on simple strings.

And so on.


I've attached a patch that implements the above. Caution, this is not tested yet nor benchmarked. It is simply the stuff I've done so far.


Second version of the patch. AccessControllTests pass now.


Thanks for the work on the patch micha; but I'm afraid this just isn't mature enough to go into 4.1 as-is. So I'm resetting this to New and let's hope someone picks it up and actually merges the code. For now, I'm going to continue with my existing non-core solutions.


The work in the patch shows that we can get away with the TWiki::User object all together. In this respect the patch is only a start. Nevertheless the code does work out properly. It only needs testers.

CC, is there any other objection wrt to the actual patch? Which non-core solution does there exist you are currently using?

For now I'd say that we defer the attached patch til 4.1 is out, then work on eliminating the TWiki::User object all together and push this item up in the prio so that it gets more visibility and testers.


Followed up in Item3838 by a wider-reaching change, so closed no action.


Summary Performance: don't load all user objects every time (patch available, needs testers)
ReportedBy TWiki:Main.CrawfordCurrie

SVN Range TWiki-4.1, Tue, 28 Nov 2006, build 12081
AppliesTo Engine

Priority Enhancement
CurrentState No Action Required


TargetRelease n/a

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch users.patch r3 r2 r1 manage 13.5 K 2006-12-06 - 20:26 UnknownUser  
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r9 - 2007-04-04 - CrawfordCurrie
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