internal package Foswiki::Users::BaseUserMapping

See Published API for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package Foswiki::Users::BaseUserMapping is a Foswiki::UserMapping

User mapping is the process by which Foswiki maps from a username (a login name) to a display name and back. It is also where groups are maintained.

The Base Mapper provides support for a small number of predefined users. No registration - this is a read only usermapper. It uses the mapper prefix 'BaseUserMapping_'.

Users

  • $Foswiki::cfg{AdminUserLogin} - uses the password that was set in Configure (IF its not null)
  • $Foswiki::cfg{DefaultUserLogin} - Wiki Guest
  • Unknown User
  • Project Contributor
  • $Foswiki::cfg{Register}{RegistrationAgentWikiName}

Groups

  • $Foswiki::cfg{SuperAdminGroup}
  • Base Group

ClassMethod new ($session)

Construct the Base User Mapping object

ObjectMethod finish()

Break circular references.

ObjectMethod loginTemplateName () → templateFile

allows User Mappings to come with customised login screens - that should preffereably only over-ride the UI function

ObjectMethod handlesUser ( $cUID, $login, $wikiname) → $boolean

See baseclass for documentation.

In the Base User Mapping case, we know all the details of the users we specialise in.

ObjectMethod login2cUID ($login) → $cUID

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)

ObjectMethod getLoginName ($cUID) → login

converts an internal cUID to that user's login (undef on failure)

ObjectMethod getWikiName ($cUID) → wikiname

Map a canonical user name to a wikiname

ObjectMethod userExists( $user ) → $boolean

Determine if the user already exists or not.

ObjectMethod eachUser () → listIterator of cUIDs

See baseclass for documentation.

ObjectMethod eachGroupMember ($group) → listIterator of cUIDs

See baseclass for documentation.

The basemapper implementation assumes that there are no nested groups in the basemapper.

ObjectMethod isGroup ($name) → boolean

See baseclass for documentation.

ObjectMethod eachGroup () → List Iterator of groupnames

See baseclass for documentation.

ObjectMethod eachMembership ($cUID) → List Iterator of groups this user is in

See baseclass for documentation.

ObjectMethod groupAllowsChange($group) → boolean

returns 0 if the group is 'owned by the Base Mapper and it wants to veto adding to that group

ObjectMethod isAdmin( $cUID ) → $boolean

True if the user is an admin
  • is a member of the $Foswiki::cfg{SuperAdminGroup}

ObjectMethod getEmails($name) → @emailAddress

If $name is a cUID, return their email addresses. If it is a group, return the addresses of everyone in the group.

ObjectMethod findUserByWikiName ($wikiname) → list of cUIDs associated with that wikiname

See baseclass for documentation.

ObjectMethod checkPassword( $login, $passwordU ) → $boolean

Finds if the password is valid for the given user.

Returns 1 on success, undef on failure.

ObjectMethod setPassword( $cUID, $newPassU, $oldPassU ) → $boolean

If the $oldPassU matches matches the user's password, then it will replace it with $newPassU.

If $oldPassU is not correct and not 1, will return 0.

If $oldPassU is 1, will force the change irrespective of the existing password, adding the user if necessary.

Otherwise returns 1 on success, undef on failure.

ObjectMethod passwordError( ) → $string

returns a string indicating the error that happened in the password handlers TODO: these delayed error's should be replaced with Exceptions.

returns undef if no error

Topic revision: r1 - 21 Nov 2014, ProjectContributor
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback