Class modUser

Description

The core MODx user class.

Located in /model/modx/moduser.class.php (line 7)

xPDOObject
   |
   --xPDOSimpleObject
      |
      --modPrincipal
         |
         --modUser
Direct descendents
Class Description
 class modManagerUser Represents MODx 0.9.6.x manager user records for migration only.
 class modWebUser Represents the web_users table that is no longer used in MODx.
Variable Summary
Method Summary
 void addSessionContext (string $context)
 boolean changePassword (string $newPassword, string $oldPassword)
 integer countMessages ([mixed $read = ''])
 void endSession ()
 string generatePassword ([integer $length = 10])
 array getSettings ()
 array getUserGroups ()
 boolean hasSessionContext (mixed $context)
 boolean isAuthenticated ([string $sessionContext = 'web'])
 boolean isMember (string/array $groups, [boolean $matchAll = false])
 boolean joinGroup (mixed $groupId, [mixed $roleId = null])
 boolean leaveGroup (mixed $groupId)
 void loadAttributes ( $target, [ $context = ''], [ $reload = false])
 void remove ([ $ancestors = array()])
 boolean removeLocks ([ $options = array()])
 void removeSessionContext (string|array $context)
 void removeSessionContextVars (string $context)
 void removeSessionCookie (string $context)
 void save ([ $cacheFlag = false])
 boolean sendEmail (string $message, [ $options = array()])
Variables
Methods
addSessionContext (line 360)

Adds a new context to the user session context array.

  • access: public
void addSessionContext (string $context)
  • string $context: The context to add to the user session.
changePassword (line 306)

Change the user password.

  • return: Indicates if password was successfully changed.
  • todo: Add support for configurable password encoding.
  • access: public
boolean changePassword (string $newPassword, string $oldPassword)
  • string $newPassword: Password to set.
  • string $oldPassword: Current password for validation.
countMessages (line 518)

Gets a count of modUserMessage objects ascribed to the user.

  • return: The number of messages.
  • access: public
integer countMessages ([mixed $read = ''])
  • mixed $read
endSession (line 279)

Ends a user session completely, including all contexts.

  • access: public
void endSession ()
generatePassword (line 749)

Returns a randomly generated password

  • return: The newly generated password
  • access: public
string generatePassword ([integer $length = 10])
  • integer $length: The length of the password
getResourceGroups (line 552)

Gets all Resource Groups this user is assigned to. This may not work in the new model.

  • return: An array of Resource Group names.
  • deprecated:
  • todo: refactor this to actually work.
  • access: public
array getResourceGroups ()
getSessionContexts (line 333)

Returns an array of user session context keys.

  • return: An array of session contexts.
  • access: public
array getSessionContexts ()
getSettings (line 533)

Gets all user settings in array format.

  • return: A key -> value array of settings.
  • access: public
array getSettings ()
getUserGroupNames (line 597)

Gets all the User Group names of the groups this user belongs to.

  • return: An array of User Group names.
  • access: public
array getUserGroupNames ()
getUserGroups (line 577)

Gets all the User Group IDs of the groups this user belongs to.

  • return: An array of User Group IDs.
  • access: public
array getUserGroups ()
hasSessionContext (line 494)

Checks if the user has a specific session context.

  • return: True if the user has the context(s) specified.
  • access: public
boolean hasSessionContext (mixed $context)
  • mixed $context: Either a name of a context or array of context names to check against.
isAuthenticated (line 261)

Determines if this user is authenticated in a specific context.

Separate session contexts can allow users to login/out of specific sub-sites individually (or in collections).

  • return: true, if the user is authenticated in the specified context, false otherwise.
  • access: public
boolean isAuthenticated ([string $sessionContext = 'web'])
  • string $sessionContext: The context to determine if the user is authenticated in.
isMember (line 624)

States whether a user is a member of a group or groups. You may specify either a string name of the group, or an array of names.

  • return: True if the user is a member of any of the groups specified.
  • access: public
boolean isMember (string/array $groups, [boolean $matchAll = false])
  • string/array $groups: Either a string of a group name or an array of names.
  • boolean $matchAll: If true, requires the user to be a member of all the groups specified. If false, the user can be a member of only one to pass. Defaults to false.
joinGroup (line 652)

Join a User Group, and optionally assign a Role.

  • return: True if successful.
  • access: public
boolean joinGroup (mixed $groupId, [mixed $roleId = null])
  • mixed $groupId: Either the name or ID of the User Group to join.
  • mixed $roleId: Optional. Either the name or ID of the Role to assign to for the group.
leaveGroup (line 691)

Removes the User from the specified User Group.

  • return: True if successful.
  • access: public
boolean leaveGroup (mixed $groupId)
  • mixed $groupId: Either the name or ID of the User Group to join.
loadAttributes (line 75)

Loads the principal attributes that define a modUser security profile.

  • todo: Remove the legacy docgroup support.
  • access: public
void loadAttributes ( $target, [ $context = ''], [ $reload = false])
  • $target
  • $context
  • $reload

Redefinition of:
modPrincipal::loadAttributes()
Load attributes of the principal that define access to secured objects.
remove (line 48)

Overrides xPDOObject::remove to fire modX-specific events

{@inheritDoc}

  • access: public
void remove ([ $ancestors = array()])
  • array $ancestors

Redefinition of:
xPDOObject::remove()
Remove the persistent instance of an object permanently.
removeLocks (line 721)

Remove any locks held by the user.

  • return: True if the process was successful, or false if an error was encountered.
  • access: public
boolean removeLocks ([ $options = array()])
  • array $options: An array of options for controlling removal of specific locks or lock types.
removeSessionContext (line 410)

Removes a user session context.

  • access: public
void removeSessionContext (string|array $context)
  • string|array $context: The context key or an array of context keys.
removeSessionContextVars (line 437)

Removes the session vars associated with a specific context.

  • access: public
void removeSessionContextVars (string $context)
  • string $context: The context key.
removeSessionCookie (line 484)

Removes a session cookie for a user.

TODO Implement this.

  • access: public
void removeSessionCookie (string $context)
  • string $context: The context to remove.
save (line 20)

Overrides xPDOObject::save to fire modX-specific events

{@inheritDoc}

  • access: public
void save ([ $cacheFlag = false])
  • $cacheFlag

Redefinition of:
xPDOObject::save()
Persist new or changed objects to the database container.
sendEmail (line 767)

Send an email to the user

  • return: True if successful
  • access: public
boolean sendEmail (string $message, [ $options = array()])
  • string $message: The body of the email
  • array $options: An array of options

Inherited Methods

Inherited From modPrincipal

 modPrincipal::getAttributes()
 modPrincipal::loadAttributes()

Inherited From xPDOObject

 xPDOObject::__construct()
 xPDOObject::addMany()
 xPDOObject::addOne()
 xPDOObject::addValidationRule()
 xPDOObject::encode()
 xPDOObject::fromArray()
 xPDOObject::fromJSON()
 xPDOObject::get()
 xPDOObject::getFieldName()
 xPDOObject::getFKClass()
 xPDOObject::getFKDefinition()
 xPDOObject::getMany()
 xPDOObject::getOne()
 xPDOObject::getOption()
 xPDOObject::getPK()
 xPDOObject::getPKType()
 xPDOObject::getPrimaryKey()
 xPDOObject::getSelectColumns()
 xPDOObject::getValidator()
 xPDOObject::isDirty()
 xPDOObject::isLazy()
 xPDOObject::isNew()
 xPDOObject::isValidated()
 xPDOObject::load()
 xPDOObject::loadCollection()
 xPDOObject::loadCollectionGraph()
 xPDOObject::remove()
 xPDOObject::removeValidationRules()
 xPDOObject::save()
 xPDOObject::set()
 xPDOObject::setDirty()
 xPDOObject::setOption()
 xPDOObject::toArray()
 xPDOObject::toJSON()
 xPDOObject::validate()
 xPDOObject::_getAliases()
 xPDOObject::_getDataType()
 xPDOObject::_getPHPType()
 xPDOObject::_getRelatedObjectsByFK()
 xPDOObject::_initFields()
 xPDOObject::_loadCollectionInstance()
 xPDOObject::_loadFieldData()
 xPDOObject::_loadInstance()
 xPDOObject::_loadRows()
 xPDOObject::_loadValidation()
 xPDOObject::_saveRelatedObject()
 xPDOObject::_saveRelatedObjects()
 xPDOObject::_setRaw()

Documentation generated on Fri, 17 Jun 2011 10:03:53 -0600 by phpDocumentor 1.4.3