Question
I've written a plugin that uses initializeUserHandler to change the loginName of a user according to various rules (e.g. handle cases where the REMOTE_USER variable is in a format that isn't an allowable TWiki login name, map the same person coming in from different authentication domains to the same user, etc). There are a few questions that came up when writing this plugin:
- Plugin options set on the plugin topic aren't initialized early enough to be used in initializeUserHandler. I wound up using functions (parseText and formatAsFlag) directly from the Prefs module. Is that the best way to do it? How likely will I be to get hurt later by this (having things change out from under me)?
- I wanted to find out if a given username is registered by checking to see if s/he has a WikiName. But, there is no easy way to do so from Func.pm (the provided userToWikiName function will just return $loginUser if it doesn't have a Wiki name). Is this the intended behavior? I wound up just checking for the existence of a key in the TWiki::userToWikiList hash.
Environment
--
TWikiGuest - 04 Jun 2004
Answer
Well, I suspect the answer to both of those questions is something on the order of, ''That's the way things are, and you take your chances.'' I'll post the plugin to
the Plugins web at some not-too-distant future date, and mark this question as ''Answered'' w/in a few days.
--
TWikiGuest - 21 Jun 2004
Delayed reply:
- Although not recommended, you can use undocumented functions. Be prepared to fix your Plugin on a TWiki upgrade.
- There is no FuncDotPm to check if user is registered. A heuristic method is to call userToWikiName, then to check if the result is a WikiWord. This fails in case a login name is a WikiWord (unlikely in most environments)
--
PeterThoeny - 28 Jun 2004