Refactoring Proposal: User Object
The code is currently very confusing in its treatment of users. There is no consistent way to recover user information, and a confusion between login names and wiki names. Also, the checking of permissions is haphazard, is not guaranteed to be consistent, and forces duplication of much code in UI.
This proposal
- creates a User object for each user in the system.
- adds a new class Users that takes over the resposibilites of the old User singleton
- converts all access control checks to use User objects
- changes access control to use exceptions
- moves access control checks down into Store
Instead of passing strings login names around, the interface is now to pass user objects around. Each user object may be interrogated to find out the login name, wiki name, and registraion web for the user.
Failed access control checks throw a new exception object,
AccessControlException, that is caught in User,pm. This alows:
- all scripts to share the same code for redirecting to an "auth" alternative if it exists e.g. viewauth, changesauth, saveauth.
- Failures to access topics other than the headline topic to be handled by redirecting to auth
- Detailed diagnostic for which topic access failed
The code changes do not imply any functionality changes. Data should be fully compatible with older versions of TWiki.
Committed to DEVELOP branch as rev 3555
--
CrawfordCurrie - 20 Jan 2005