LiveUser
[ class tree: LiveUser ] [ index: LiveUser ] [ all elements ]

Class: LiveUser_Auth_Common

Source Location: /LiveUser-0.16.2/Auth/Common.php

Class Overview


This class provides a set of functions for implementing a user authorisation system on live websites. All authorisation backends/containers must be extensions of this base class.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2005 Markus Wolff

Variables

Methods


Child classes:

LiveUser_Auth_XML
XML driver for authentication
LiveUser_Auth_MDB2
MDB2 container for Authentication
LiveUser_Auth_Session
Session based container for Authentication
LiveUser_Auth_MDB
MDB container for Authentication
LiveUser_Auth_DB
DB container for Authentication
LiveUser_Auth_PEARAuth
PEAR_Auth container for Authentication

Inherited Variables

Inherited Methods


Class Details

[line 66]
This class provides a set of functions for implementing a user authorisation system on live websites. All authorisation backends/containers must be extensions of this base class.

Requirements:

  • When using "DB" backend: PEAR::DB database abstraction layer
  • LiveUser admin GUI for easy user administration and setup of authorisation areas and rights



[ Top ]


Class Variables

$alias = array()

[line 279]

  • Access: public

Type:   array


[ Top ]

$allowDuplicateHandles =  false

[line 184]

Allow multiple users in the database to have the same login handle. Default: false.
  • Access: protected

Type:   boolean


[ Top ]

$allowEmptyPasswords =  false

[line 191]

Allow empty passwords to be passed to LiveUser. Default: false.
  • Access: protected

Type:   boolean


[ Top ]

$authUserId =  0

[line 91]

Current user's database record id
  • Access: protected

Type:   integer


[ Top ]

$backendArrayIndex =  0

[line 223]

Defines the array index number of the LoginManager?s "backends" property.
  • Access: protected

Type:   integer


[ Top ]

$containerName =  null

[line 250]

The name associated with this auth container. The name is used when adding users from this container to the reference table in the permission container. This way it is possible to see from which auth container the user data is coming from.
  • Access: public

Type:   string


[ Top ]

$currentLogin =  0

[line 148]

Timestamp of current login (last to be written)
  • Access: protected

Type:   integer


[ Top ]

$encryptionModes = array('MD5'   => 'MD5',
                                 'PLAIN' => 'PLAIN',
                                 'RC4'   => 'RC4',
                                 'SHA1'  => 'SHA1')

[line 198]

Set posible encryption modes.
  • Access: protected

Type:   array


[ Top ]

$expireTime =  0

[line 166]

Auth lifetime in seconds

If this variable is set to 0, auth never expires

  • Access: protected

Type:   integer


[ Top ]

$externalValues = array()

[line 258]

External values to check (config settings)
  • Access: public

Type:   array


[ Top ]

$fields = array()

[line 272]

  • Access: public

Type:   array


[ Top ]

$handle =  ''

[line 76]

The handle (username) of the current user
  • Access: protected

Type:   string


[ Top ]

$idleTime =  0

[line 176]

Maximum time of idleness in seconds

Idletime gets refreshed each time, init() is called. If this variable is set to 0, idle time is never checked.

  • Access: protected

Type:   integer


[ Top ]

$isActive =  null

[line 104]

Is the current user allowed to login at all? If false,

a call to login() will not set $logged_in to true, even if handle and password were submitted correctly. This is useful when you want your users to be activated by an administrator before they can actually use your application. Default: false

  • See: LiveUser_Auth_Common::loggedIn
  • Access: protected

Type:   boolean


[ Top ]

$lastLogin =  0

[line 134]

Timestamp of last login (previous to currentLogin)
  • Access: protected

Type:   integer


[ Top ]

$loggedIn =  null

[line 127]

Has the current user successfully logged in? Default: false
  • See: LiveUser_Auth_Common::isActive
  • Access: protected

Type:   boolean


[ Top ]

$loginTimeout =  12

[line 157]

Number of hours that must pass between two logins to be counted as a new login. Comes in handy in some situations. Default: 12
  • Access: protected

Type:   integer


[ Top ]

$ownerGroupId =  null

[line 118]

Owner User Id
  • Access: protected

Type:   int


[ Top ]

$ownerUserId =  null

[line 111]

Owner User Id
  • Access: protected

Type:   int


[ Top ]

$passwd =  ''

[line 84]

The password of the current user as given to the login() method.
  • Access: protected

Type:   string


[ Top ]

$passwordEncryptionMode =  'MD5'

[line 209]

Defines the algorithm used for encrypting/decrypting passwords. Default: "MD5".
  • Access: protected

Type:   string


[ Top ]

$propertyValues = array()

[line 239]

Property values
  • Access: public

Type:   array


[ Top ]

$secret =

[line 216]

Defines the secret to use for encryption if needed
  • Access: protected

Type:   string


[ Top ]

$tables = array()

[line 265]

  • Access: public

Type:   array


[ Top ]

$updateLastLogin =  true

[line 141]

Update the last login time or not
  • Access: protected

Type:   boolean


[ Top ]

$_stack =  null

[line 230]

Error stack
  • Access: protected

Type:   PEAR_ErrorStack


[ Top ]



Method Detail

LiveUser_Auth_Common (Constructor)   [line 289]

void LiveUser_Auth_Common( )

Class constructor. Feel free to override in backend subclasses.
  • Var: configuration options
  • Access: protected

[ Top ]

decryptPW   [line 403]

string decryptPW( string $encryptedPW)

Decrypts a password so that it can be compared with the user input. Uses the algorithm defined in the passwordEncryptionMode property.
  • Return: The decrypted password
  • Access: public

Parameters:

string   $encryptedPW   —  the encrypted password

[ Top ]

disconnect   [line 636]

void disconnect( )

properly disconnect from resources
  • Access: public

Overridden in child classes as:

LiveUser_Auth_XML::disconnect()
Properly disconnect from resources
LiveUser_Auth_MDB2::disconnect()
properly disconnect from database
LiveUser_Auth_MDB::disconnect()
Properly disconnect from database
LiveUser_Auth_DB::disconnect()
Properly disconnect from database

[ Top ]

encryptPW   [line 437]

string encryptPW( string $plainPW)

Encrypts a password for storage in a backend container.

Uses the algorithm defined in the passwordEncryptionMode property.

  • Return: The encrypted password
  • Access: public

Parameters:

string   $plainPW   —  encryption type

[ Top ]

externalValuesMatch   [line 612]

boolean externalValuesMatch( )

Check if the stored external values match the current external values
  • Access: public

[ Top ]

freeze   [line 349]

array freeze( )

store all properties in an array
  • Access: public

[ Top ]

getProperty   [line 574]

mixed getProperty( string $what)

Function returns the inquired value if it exists in the class.
  • Return: null, a value or an array.
  • Access: public

Parameters:

string   $what   —  Name of the property to be returned.

[ Top ]

init   [line 303]

boolean init( $conf, string $containerName, mixed &$conf)

Load the storage container
  • Return: true on success or false on failure
  • Access: public

Overridden in child classes as:

LiveUser_Auth_XML::init()
Load the storage container
LiveUser_Auth_MDB2::init()
Load the storage container
LiveUser_Auth_Session::init()
Load the storage container
LiveUser_Auth_MDB::init()
Load the storage container
LiveUser_Auth_DB::init()
Load the storage container
LiveUser_Auth_PEARAuth::init()
Load the storage container

Parameters:

mixed   &$conf   —  Name of array containing the configuration.
string   $containerName   —  name of the container that should be used
   $conf   — 

[ Top ]

isNewLogin   [line 472]

boolean isNewLogin( )

Checks if there's enough time between lastLogin and current login (now) to count as a new login.
  • Return: true if it is a new login, false if not
  • Access: public

[ Top ]

login   [line 492]

boolean login( string $handle, string $passwd)

Tries to make a login with the given handle and password.

A user can't login if he's not active.

  • Access: public

Parameters:

string   $handle   —  user handle
string   $passwd   —  user password

[ Top ]

readUserData   [line 559]

void readUserData( [string $handle = ''], [boolean $passwd = ''], [string $authUserId = false])

Reads auth_user_id, passwd, is_active flag

lastlogin timestamp from the database If only $handle is given, it will read the data from the first user with that handle and return true on success. If $handle and $passwd are given, it will try to find the first user with both handle and password matching and return true on success (this allows multiple users having the same handle but different passwords - yep, some people want this). If no match is found, false is being returned.

Again, this does nothing in the base class. The described functionality must be implemented in a subclass overriding this method.

  • Access: public

Overridden in child classes as:

LiveUser_Auth_DB::readUserData()
Reads auth_user_id, passwd, is_active flag

Parameters:

string   $handle   —  user handle
boolean   $passwd   —  user password
string   $authUserId   —  auth user id

[ Top ]

setExternalValues   [line 591]

void setExternalValues( )

Creates associative array of values from $externalValues['values'] with $keysToCheck
  • Access: public

[ Top ]

unfreeze   [line 384]

boolean unfreeze( array $propertyValues)

Reinitializes properties

Parameters:

array   $propertyValues   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:17:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.