[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> class.t3lib_userauth.php (sommaire)

Contains a base class for authentication of users in TYPO3, both frontend and backend. $Id: class.t3lib_userauth.php 2043 2007-02-16 11:33:32Z mundaun $ Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj

Author: Kasper Skaarhoj <kasperYYYY@typo3.com>
Author: René Fritz <r.fritz@colorcube.de>
Poids: 1261 lignes (50 kb)
Inclus ou requis:0 fois
Référencé: 2 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_userAuth:: (32 méthodes):
  start()
  isSetSessionCookie()
  isRefreshTimeBasedCookie()
  checkAuthentication()
  createUserSession()
  getNewSessionRecord()
  fetchUserSession()
  logoff()
  user_where_clause()
  ipLockClause()
  ipLockClause_remoteIPNumber()
  hashLockClause()
  hashLockClause_getHashInt()
  writeUC()
  unpack_uc()
  pushModuleData()
  getModuleData()
  getSessionData()
  setAndSaveSessionData()
  getLoginFormData()
  processLoginData()
  getAuthInfoArray()
  compareUident()
  gc()
  redirect()
  writelog()
  checkLogFailures()
  setBeUserByUid()
  setBeUserByName()
  getRawUserByUid()
  getRawUserByName()
  fetchUserRecord()


Classe: t3lib_userAuth  - X-Ref

Authentication of users in TYPO3

This class is used to authenticate a login user.
The class is used by both the frontend and backend. In both cases this class is a parent class to beuserauth and feuserauth

See Inside TYPO3 for more information about the API of the class and internal variables.

start()   X-Ref
Starts a user session
Typical configurations will:
a) check if session cookie was set and if not, set one,
b) check if a password/username was sent and if so, try to authenticate the user
c) Lookup a session attached to a user and check timeout etc.
d) Garbage collection, setting of no-cache headers.
If a user is authenticated the database record of the user (array) will be set in the ->user internal variable.

return: void

isSetSessionCookie()   X-Ref
Determins whether a session cookie needs to be set (lifetime=0)

return: boolean

isRefreshTimeBasedCookie()   X-Ref
Determins whether a non-session cookie needs to be set (lifetime>0)

return: boolean

checkAuthentication()   X-Ref
Checks if a submission of username and password is present or use other authentication by auth services

return: void

createUserSession($tempuser)   X-Ref
Creates a user session record.

param: array        user data array
return: void

getNewSessionRecord($tempuser)   X-Ref
Returns a new session record for the current user for insertion into the DB.
This function is mainly there as a wrapper for inheriting classes to override it.

return: array        user session record

fetchUserSession()   X-Ref
Read the user session from db.

return: array        user session data

logoff()   X-Ref
Log out current user!
Removes the current session record, sets the internal ->user array to a blank string; Thereby the current user (if any) is effectively logged out!

return: void

user_where_clause()   X-Ref
This returns the where-clause needed to select the user with respect flags like deleted, hidden, starttime, endtime

return: string

ipLockClause()   X-Ref
This returns the where-clause needed to lock a user to the IP address

return: string

ipLockClause_remoteIPNumber($parts)   X-Ref
Returns the IP address to lock to.
The IP address may be partial based on $parts.

param: integer        1-4: Indicates how many parts of the IP address to return. 4 means all, 1 means only first number.
return: string        (Partial) IP address for REMOTE_ADDR

hashLockClause()   X-Ref
This returns the where-clause needed to lock a user to a hash integer

return: string

hashLockClause_getHashInt()   X-Ref
Creates hash integer to lock user to. Depends on configured keywords

return: integer        Hash integer

writeUC($variable='')   X-Ref
This writes $variable to the user-record. This is a way of providing session-data.
You can fetch the data again through $this->uc in this class!
If $variable is not an array, $this->uc is saved!

param: array        An array you want to store for the user as session data. If $variable is not supplied (is blank string), the internal variable, ->uc, is stored by default
return: void

unpack_uc($theUC='')   X-Ref
Sets $theUC as the internal variable ->uc IF $theUC is an array. If $theUC is false, the 'uc' content from the ->user array will be unserialized and restored in ->uc

param: mixed        If an array, then set as ->uc, otherwise load from user record
return: void

pushModuleData($module,$data,$noSave=0)   X-Ref
Stores data for a module.
The data is stored with the session id so you can even check upon retrieval if the module data is from a previous session or from the current session.

param: string        $module is the name of the module ($MCONF['name'])
param: mixed        $data is the data you want to store for that module (array, string, ...)
param: boolean        If $noSave is set, then the ->uc array (which carries all kinds of user data) is NOT written immediately, but must be written by some subsequent call.
return: void

getModuleData($module,$type='')   X-Ref
Gets module data for a module (from a loaded ->uc array)

param: string        $module is the name of the module ($MCONF['name'])
param: string        If $type = 'ses' then module data is returned only if it was stored in the current session, otherwise data from a previous session will be returned (if available).
return: mixed        The module data if available: $this->uc['moduleData'][$module];

getSessionData($key)   X-Ref
Returns the session data stored for $key.
The data will last only for this login session since it is stored in the session table.

param: string        Pointer to an associative key in the session data array which is stored serialized in the field "ses_data" of the session table.
return: mixed

setAndSaveSessionData($key,$data)   X-Ref
Sets the session data ($data) for $key and writes all session data (from ->user['ses_data']) to the database.
The data will last only for this login session since it is stored in the session table.

param: string        Pointer to an associative key in the session data array which is stored serialized in the field "ses_data" of the session table.
param: mixed        The variable to store in index $key
return: void

getLoginFormData()   X-Ref
Returns an info array with Login/Logout data submitted by a form or params

return: array

processLoginData($loginData, $security_level='')   X-Ref
Processes Login data submitted by a form or params depending on the
security_level

param: array        login data array
param: string        Alternative security_level. Used when authentication services wants to override the default.
return: array        processed login data array

getAuthInfoArray()   X-Ref
Returns an info array which provides additional information for auth services

return: array

compareUident($user, $loginData, $security_level='')   X-Ref
Check the login data with the user record data for builtin login methods

param: array        user data array
param: array        login data array
param: string        Alternative security_level. Used when authentication services wants to override the default.
return: boolean        true if login data matched

gc()   X-Ref
Garbage collector, removing old expired sessions.

return: void

redirect()   X-Ref
Redirect to somewhere. Obsolete, deprecated etc.

return: void

writelog($type,$action,$error,$details_nr,$details,$data,$tablename,$recuid,$recpid)   X-Ref
DUMMY: Writes to log database table (in some extension classes)

param: integer        $type: denotes which module that has submitted the entry. This is the current list:  1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent
param: integer        $action: denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!)
param: integer        $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
param: integer        $details_nr: The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages
param: string        $details: Default text that follows the message
param: array        $data: Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text...
param: string        $tablename: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
param: integer        $recuid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
param: integer        $recpid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
return: void

checkLogFailures()   X-Ref
DUMMY: Check login failures (in some extension classes)

return: void

setBeUserByUid($uid)   X-Ref
Raw initialization of the be_user with uid=$uid
This will circumvent all login procedures and select a be_users record from the database and set the content of ->user to the record selected. Thus the BE_USER object will appear like if a user was authenticated - however without a session id and the fields from the session table of course.
Will check the users for disabled, start/endtime, etc. ($this->user_where_clause())

param: integer        The UID of the backend user to set in ->user
return: void

setBeUserByName($name)   X-Ref
Raw initialization of the be_user with username=$name

param: string        The username to look up.
return: void

getRawUserByUid($uid)   X-Ref
Fetching raw user record with uid=$uid

param: integer        The UID of the backend user to set in ->user
return: array        user record or FALSE

getRawUserByName($name)   X-Ref
Fetching raw user record with username=$name

param: string        The username to look up.
return: array        user record or FALSE

fetchUserRecord($dbUser, $username, $extraWhere='' )   X-Ref
Get a user from DB by username
provided for usage from services

param: array        User db table definition: $this->db_user
param: string        user name
param: string        additional WHERE clause: " AND ...
return: mixed        user array or FALSE



Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics