eZUser Class Reference
[Kernel system]

eZUser handles Exponential user accounts More...

Inheritance diagram for eZUser:

eZPersistentObject List of all members.

Public Methods

definition ()
 attribute ($name)
 setInformation ($id,$login,$email,$password,$passwordConfirm=false)
fetchBuiltin ($id)
 id ()
 authenticationMatch ()
 loginCurrent ()
 logoutCurrent ()
instance ($id=false)
roles ()
roleIDList ()
isLoggedIn ()
groups ($asObject=false,$userID=false)

Static Public Methods

 hashType ()
 site ()
loginUser ($login,$password,$authenticationMatch=false)
currentUser ()
currentUserID ()
 authenticateHash ($user,$password,$site,$type,$hash)
 passwordCharacterTable ()
 createPassword ($passwordLength,$seed=false)
 createHash ($user,$password,$site,$type)

Public Attributes

 Login
 \privatesection


Detailed Description

eZUser handles Exponential user accounts

Definition at line ezuser.php.


Member Function Documentation

eZUser::attribute   name
 

Returns:
the attribute data for $attr, this is either returned from the member variables or a member function depending on whether the definition field or function attributes matched.

Reimplemented from eZPersistentObject.

Definition at line ezuser.php.

References roles().

Referenced by roles().

eZUser::authenticateHash   user,
  password,
  site,
  type,
  hash
[static]
 

Creates a hash out of $user, $password and $site according to the type $type.

Returns:
true if the generated hash is equal to the supplied hash $hash.

Definition at line ezuser.php.

References site().

Referenced by loginUser().

eZUser::authenticationMatch  
 

Returns:
a bitfield which decides the authenticate methods.

Definition at line ezuser.php.

References eZINI::instance().

Referenced by eZUserType::validateObjectAttributeHTTPInput().

eZUser::createHash   user,
  password,
  site,
  type
[static]
 

Will create a hash of the given string. This is used to store the passwords in the database.

Definition at line ezuser.php.

References eZDebugSetting::writeDebug().

Referenced by setInformation().

eZUser::createPassword   passwordLength,
  seed = false
[static]
 

Creates a password with number of characters equal to $passwordLength and returns it. If you want pass a value in $seed it will be used as basis for the password, if not it will use the current time value as seed.

Note:
If $passwordLength exceeds 16 it will need to generate new seed for the remaining characters.

Definition at line ezuser.php.

References passwordCharacterTable().

& eZUser::currentUser   [static]
 

Returns the currently logged in user.

Definition at line ezuser.php.

References instance().

Referenced by eZAuthorType::objectAttributeContent().

& eZUser::currentUserID   [static]
 

Returns the ID of the currently logged in user.

Definition at line ezuser.php.

References instance().

Referenced by eZCollaborationItem::attribute().

& eZUser::definition  
 

Returns:
the definition for the object, the default implementation is to return an empty array. It's upto each inheriting class to return a proper definition array.
The definition array is an associative array consists of these keys:
  • fields - an associative array of fields which defines which database field (the key) is to fetched and how they map to object member variables (the value).
  • keys - an array of fields which is used for uniquely identifying the object in the table.
  • function_attributes - an associative array of attributes which maps to member functions, used for fetching data with functions.
  • set_functions - an associative array of attributes which maps to member functions, used for setting data with functions.
  • increment_key - the field which is incremented on table inserts.
  • class_name - the classname which is used for instantiating new objecs when fetching from the database.
  • sort - an associative array which defines the default sorting of lists, the key is the table field while the value is the sorting method which is either asc or desc.
  • name - the name of the database table
Example:
function definition()
{
    return array( "fields" => array( "id" => "ID",
                                     "version" => "Version",
                                     "name" => "Name" ),
                  "keys" => array( "id", "version" ),
                  "function_attributes" => array( "current" => "currentVersion",
                                                  "class_name" => "className" ),
                  "increment_key" => "id",
                  "class_name" => "eZContentClass",
                  "sort" => array( "id" => "asc" ),
                  "name" => "ezcontentclass" );
}

Reimplemented from eZPersistentObject.

Definition at line ezuser.php.

References roles().

& eZUser::fetchBuiltin   id
 

Fetches a builtin user and returns it, this helps avoid special cases where user is not logged in.

Definition at line ezuser.php.

References id().

& eZUser::groups   asObject = false,
  userID = false
 

Returns:
an array of id's with all the groups the user belongs to.

Definition at line ezuser.php.

References eZDB::instance().

Referenced by roles().

eZUser::hashType   [static]
 

Returns:
the default hash type which is specified in UserSettings/HashType in site.ini

Definition at line ezuser.php.

References eZINI::instance().

Referenced by setInformation().

eZUser::id  
 

Returns:
the user id.

Definition at line ezuser.php.

Referenced by setInformation().

& eZUser::instance   id = false
 

Finds the user with the id $id and returns the unique instance of it. If the user instance is not created yet it tries to either fetch it from the database with eZUser::fetch(). If $id is false or the user was not found, the default user is returned. This is a site.ini setting under UserSettings:AnonymousUserID. The instance is then returned. If $id is false then the current user is fetched.

Definition at line ezuser.php.

References eZDebug::writeWarning().

Referenced by currentUserID().

& eZUser::isLoggedIn  
 

Returns true if it's a real user which is logged in. False if the user is the default user or the fallback buildtin user.

Definition at line ezuser.php.

Referenced by definition().

eZUser::loginCurrent  
 

Returns:
logs in the current user object

Definition at line ezuser.php.

& eZUser::loginUser   login,
  password,
  authenticationMatch = false
[static]
 

Logs in the user if applied username and password is valid. The userID is returned if succesful, false if not.

Definition at line ezuser.php.

References eZDebugSetting::writeDebug().

eZUser::logoutCurrent  
 

Logs out the current user

Definition at line ezuser.php.

References eZHTTPTool::instance().

eZUser::passwordCharacterTable   [static]
 

Returns:
an array with characters which are allowed in password.

Definition at line ezuser.php.

References eZINI::instance().

Referenced by createPassword().

& eZUser::roleIDList  
 

Returns:
an array of role ids which the user is assigned to

Definition at line ezuser.php.

References groups().

& eZUser::roles  
 

Returns:
an array of roles which the user is assigned to

Definition at line ezuser.php.

References roles().

Referenced by roles().

eZUser::setInformation   id,
  login,
  email,
  password,
  passwordConfirm = false
 

Fills in the $id, $login, $email and $password for the user and creates the proper password hash.

Definition at line ezuser.php.

References site().

eZUser::site   [static]
 

Returns:
the site name used in password hashing.

Definition at line ezuser.php.

References eZINI::instance().

Referenced by setInformation().


The documentation for this class was generated from the following file:  

Exponential