1 # <a name="Package <code>TWiki::Users::_BaseUser"></a> Package =TWiki::Users::BaseUserMapping
3 User mapping is the process by which TWiki maps from a username (a login name) to a display name and back. It is also where groups are maintained.
5 The [[BaseMapper]] provides support for a small number of predefined users. No registration - this is a read only usermapper. It uses the mapper prefix 'BaseUserMapping\_'.
7 ## <a name="Users"></a> Users
9 - [[TWikiAdmin]] - uses the password that was set in Configure (IF its not null)
12 - [[TWikiContributor]] - 1 Jan 2005
13 - [[TWikiRegistrationAgent]] - 1 Jan 2005
15 ### <a name="Groups"></a> Groups
17 - $TWiki::cfg\{SuperAdminGroup\}
22 <li><a href="#Package =TWiki::Users::_BaseUser"> Package TWiki::Users::BaseUserMapping</a><ul>
23 <li><a href="#Users"> Users</a><ul>
24 <li><a href="#Groups"> Groups</a></li>
27 <li><a href="#ClassMethod <strong>new</strong> ($session)"> ClassMethod new <tt>($session)</tt></a></li>
28 <li><a href="#ObjectMethod <strong>finish</strong> ()"> ObjectMethod finish <tt>()</tt></a></li>
29 <li><a href="#ObjectMethod *login_TemplateName"> ObjectMethod loginTemplateName <tt>() -> templateFile</tt></a></li>
30 <li><a href="#ObjectMethod <strong>handlesUser</strong> ($cUI"> ObjectMethod handlesUser <tt>($cUID,$login,$wikiname) -> $boolean</tt></a></li>
31 <li><a href="#ObjectMethod <strong>login2cUID</strong> ($logi"> ObjectMethod login2cUID <tt>($login) -> $cUID</tt></a></li>
32 <li><a href="#ObjectMethod <strong>get_LoginName</strong> ($c"> ObjectMethod getLoginName <tt>($cUID) -> login</tt></a></li>
33 <li><a href="#ObjectMethod <strong>get_WikiName</strong> ($cU"> ObjectMethod getWikiName <tt>($cUID) -> wikiname</tt></a></li>
34 <li><a href="#ObjectMethod <strong>userExists</strong> ($user"> ObjectMethod userExists <tt>($user) -> $boolean</tt></a></li>
35 <li><a href="#ObjectMethod <strong>eachUser</strong> () -> li"> ObjectMethod eachUser <tt>() -> listIteratorofcUIDs</tt></a></li>
36 <li><a href="#ObjectMethod *each_GroupMember*"> ObjectMethod eachGroupMember <tt>($group) -> listIteratorofcUIDs</tt></a></li>
37 <li><a href="#ObjectMethod <strong>isGroup</strong> ($name) -"> ObjectMethod isGroup <tt>($name) -> boolean</tt></a></li>
38 <li><a href="#ObjectMethod <strong>eachGroup</strong> () ->"> ObjectMethod eachGroup <tt>() -> ListIteratorofgroupnames</tt></a></li>
39 <li><a href="#ObjectMethod <strong>eachMembership</strong> ($"> ObjectMethod eachMembership <tt>($cUID) -> ListIteratorofgroupsthisuserisin</tt></a></li>
40 <li><a href="#ObjectMethod <strong>isAdmin</strong> ($cUID) -"> ObjectMethod isAdmin <tt>($cUID) -> $boolean</tt></a></li>
41 <li><a href="#ObjectMethod <strong>getEmails</strong> ($name)"> ObjectMethod getEmails <tt>($name) -> @emailAddress</tt></a></li>
42 <li><a href="#ObjectMethod *find_UserByWikiNam"> ObjectMethod findUserByWikiName <tt>($wikiname) -> listofcUIDsassociatedwiththatwikiname</tt></a></li>
43 <li><a href="#ObjectMethod <strong>checkPassword</strong> ($l"> ObjectMethod checkPassword <tt>($login,$passwordU) -> $boolean</tt></a></li>
44 <li><a href="#ObjectMethod <strong>setPassword</strong> ($cUI"> ObjectMethod setPassword <tt>($cUID,$newPassU,$oldPassU) -> $boolean</tt></a></li>
45 <li><a href="#ObjectMethod <strong>passwordError</strong> ()"> ObjectMethod passwordError <tt>() -> $string</tt></a></li>
51 ## <a name="ClassMethod <strong>new</strong> ($session)"></a> [[ClassMethod]] **new** `($session)`
53 Construct the [[BaseUserMapping]] object
55 ## <a name="ObjectMethod <strong>finish</strong> ()"></a> [[ObjectMethod]] **finish** `()`
57 Break circular references.
59 ## <a name="ObjectMethod <strong>login_TemplateName"></a> [[ObjectMethod]] \*loginTemplateName `() -> templateFile`
61 allows [[UserMappings]] to come with customised login screens - that should preffereably only over-ride the UI function
63 ## <a name="ObjectMethod <strong>handlesUser</strong> ($cUI"></a> [[ObjectMethod]] **handlesUser** `($cUID,$login,$wikiname) -> $boolean`
65 See baseclass for documentation.
67 In the [[BaseUserMapping]] case, we know all the details of the users we specialise in.
69 ## <a name="ObjectMethod <strong>login2cUID</strong> ($logi"></a> [[ObjectMethod]] **login2cUID** `($login) -> $cUID`
71 Convert a login name to the corresponding canonical user name. The canonical name can be any string of 7-bit alphanumeric and underscore characters, and must correspond 1:1 to the login name. (undef on failure)
73 ## <a name="ObjectMethod <strong>get_LoginName</strong> ($c"></a> [[ObjectMethod]] **getLoginName** `($cUID) -> login`
75 converts an internal cUID to that user's login (undef on failure)
77 ## <a name="ObjectMethod <strong>get_WikiName</strong> ($cU"></a> [[ObjectMethod]] **getWikiName** `($cUID) -> wikiname`
79 Map a canonical user name to a wikiname
81 ## <a name="ObjectMethod <strong>userExists</strong> ($user"></a> [[ObjectMethod]] **userExists** `($user) -> $boolean`
83 Determine if the user already exists or not.
85 ## <a name="ObjectMethod <strong>eachUser</strong> () - lis"></a> [[ObjectMethod]] **eachUser** `() -> listIteratorofcUIDs`
87 See baseclass for documentation.
89 ## <a name="ObjectMethod <strong>each_GroupMember*"></a><a name="ObjectMethod *each_GroupMember</strong> "></a> [[ObjectMethod]] **eachGroupMember** `($group) -> listIteratorofcUIDs`
91 See baseclass for documentation.
93 The basemapper implementation assumes that there are no nested groups in the basemapper.
95 ## <a name="ObjectMethod <strong>isGroup</strong> ($name) -"></a> [[ObjectMethod]] **isGroup** `($name) -> boolean`
97 See baseclass for documentation.
99 ## <a name="ObjectMethod <strong>eachGroup</strong> () - _L"></a> [[ObjectMethod]] **eachGroup** <tt>() -> [[ListIteratorofgroupnames]]</tt>
101 See baseclass for documentation.
103 ## <a name="ObjectMethod <strong>eachMembership</strong> ($"></a> [[ObjectMethod]] **eachMembership** <tt>($cUID) -> [[ListIteratorofgroupsthisuserisin]]</tt>
105 See baseclass for documentation.
107 ## <a name="ObjectMethod <strong>isAdmin</strong> ($cUID) -"></a> [[ObjectMethod]] **isAdmin** `($cUID) -> $boolean`
109 True if the user is an admin
111 - is a member of the $TWiki::cfg\{SuperAdminGroup\}
113 ## <a name="ObjectMethod <strong>getEmails</strong> ($name)"></a> [[ObjectMethod]] **getEmails** `($name) -> @emailAddress`
115 If $name is a cUID, return their email addresses. If it is a group, return the addresses of everyone in the group.
117 ## <a name="ObjectMethod <strong>find_UserByWikiNam"></a> [[ObjectMethod]] \*findUserByWikiName `($wikiname) -> listofcUIDsassociatedwiththatwikiname`
119 See baseclass for documentation.
121 ## <a name="ObjectMethod <strong>checkPassword</strong> ($l"></a> [[ObjectMethod]] **checkPassword** `($login,$passwordU) -> $boolean`
123 Finds if the password is valid for the given user.
125 Returns 1 on success, undef on failure.
127 ## <a name="ObjectMethod <strong>setPassword</strong> ($cUI"></a> [[ObjectMethod]] **setPassword** `($cUID,$newPassU,$oldPassU) -> $boolean`
129 If the $oldPassU matches matches the user's password, then it will replace it with $newPassU.
131 If $oldPassU is not correct and not 1, will return 0.
133 If $oldPassU is 1, will force the change irrespective of the existing password, adding the user if necessary.
135 Otherwise returns 1 on success, undef on failure.
137 ## <a name="ObjectMethod <strong>passwordError</strong> ()"></a><a name="ObjectMethod <strong>passwordError</strong> () "></a> [[ObjectMethod]] **passwordError** `() -> $string`
139 returns a string indicating the error that happened in the password handlers TODO: these delayed error's should be replaced with Exceptions.
141 returns undef if no error