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

Class: LiveUser_Admin_Auth_Container_DB

Source Location: /LiveUser-0.13.0/Admin/Auth/Container/DB.php

Class Overview

LiveUser_Admin_Auth_Common
   |
   --LiveUser_Admin_Auth_Container_DB

Simple DB-based complexity driver for LiveUser.


Author(s):

Version:

  • $Id: DB.php,v 1.64 2004/08/28 17:00:48 lsmith Exp $

Variables

Methods


Inherited Variables

Inherited Methods

Class: LiveUser_Admin_Auth_Common

LiveUser_Admin_Auth_Common::LiveUser_Admin_Auth_Common()
Class constructor. Feel free to override in backend subclasses.
LiveUser_Admin_Auth_Common::addUser()
Adds a new user to Auth.
LiveUser_Admin_Auth_Common::decryptPW()
Decrypts a password so that it can be compared with the user input. Uses the algorithm defined in the passwordEncryptionMode property.
LiveUser_Admin_Auth_Common::encryptPW()
Encrypts a password for storage in a backend container.
LiveUser_Admin_Auth_Common::getProperty()
Function returns the inquired value if it exists in the class.
LiveUser_Admin_Auth_Common::getUsers()
Gets all users with handle, passwd, authId, lastlogin, is_active and individual rights.
LiveUser_Admin_Auth_Common::removeUser()
Removes an existing user from Auth.
LiveUser_Admin_Auth_Common::updateUser()
Changes user data in auth table.

Class Details

[line 52]
Simple DB-based complexity driver for LiveUser.

Description: This admin class provides the following functionalities

  • adding users
  • removing users
  • update user data (auth related: username, pwd, active)
  • adding rights
  • removing rights
  • get all users
ATTENTION: This class is only experimental. API may change. Use it at your own risk.

  • Author: Bjoern Kraus <krausbn@php.net>
  • Version: $Id: DB.php,v 1.64 2004/08/28 17:00:48 lsmith Exp $


[ Top ]


Class Variables

$authTable =  'liveuser_users'

[line 78]

Auth table Table where the auth data is stored.
  • Access: public

Type:   string


[ Top ]

$authTableCols = array(
        'required' => array(
            'auth_user_id' => array('name' => 'auth_user_id', 'type' => ''),'handle'=>array('name'=>'handle','type'=>''),'passwd'=>array('name'=>'passwd','type'=>''),),'optional'=>array('lastlogin'=>array('name'=>'lastlogin','type'=>''),'is_active'=>array('name'=>'is_active','type'=>'')))

[line 91]

Columns of the auth table.

Associative array with the names of the auth table columns. The 'auth_user_id', 'handle' and 'passwd' fields have to be set. 'lastlogin', 'is_active', 'owner_user_id' and 'owner_group_id' are optional. It doesn't make sense to set only one of the time columns without the other.

  • Access: public

Type:   array


[ Top ]



Method Detail

LiveUser_Admin_Auth_Container_DB (Constructor)   [line 121]

void LiveUser_Admin_Auth_Container_DB( array &$connectOptions, [ $name = null])

Constructor

The second parameters expects an array containing the parameters for the given container.

This class expects only the array containing configuration options of the auth container you wish to administrate. This is done in case you have several DB based auth containers.

See PEAR::DB documentation for DSN specifications.

  • See: LiveUser::factory The configuration array is explained there
  • Access: protected

Parameters:

array   &$connectOptions   —  full liveuser conf array
   $name   — 

[ Top ]

addUser   [line 156]

mixed addUser( string $handle, [string $password = ''], [array $optionalFields = array()], [array $customFields = array()], [mixed $authId = null])

Adds a new user to Auth/DB.
  • Return: Users auth ID on success, DB error if not, false if not initialized
  • Access: public

Overrides LiveUser_Admin_Auth_Common::addUser() (Adds a new user to Auth.)

Parameters:

string   $handle   —  Handle (username).
string   $password   —  Password.
array   $optionalFields   —  Array of optional fields values to be added array('alias' => ''value')
array   $customFields   —  Array of custom fields values to be added array('alias' => ''value')
mixed   $authId   —  If specificed no new ID will be automatically generated instead

[ Top ]

getUsers   [line 374]

mixed getUsers( [array $filters = array()], [string $order = null], [boolean $rekey = false])

Gets all users with handle, passwd, auth_user_id lastlogin, is_active and individual rights.

The array will look like this:

  1.  $userData[0]['auth_user_id''wujha433gawefawfwfiuj2ou9823r98h';
  2.              ['handle']       'myLogin';
  3.              ['passwd']       'd346gs2gwaeiuhaeiuuweijfjuwaefhj';
  4.              ['lastlogin']    = 1254801292; (Unix timestamp)
  5.              ['is_active']    = 1; (1 = yes0 = no)
  6.              ['owner_user_id']    = 1;
  7.              ['owner_group_id']   = 1;

Filters can be either complex or simple.

In their simple form you just need to pass an associative array with key/value, the key will be the table field name and value the value you are searching. It will consider that you want an do to do a field=value comparison, every additional filter will be appended with AND

The complicated form of filters is to pass an array such as

array( 'fieldname' => array('op' => '>', 'value' => 'dummy', 'cond' => ''), 'fieldname' => array('op' => '<', 'value' => 'dummy2', 'cond' => 'OR'), );

It can then build relatively complex queries. If you need joins or more complicated queries than that please consider using an alternative solution such as PEAR::DB_DataObject

Any aditional field will be returned. The array key will be of the same case it is given.

$cols = array('myField');

e.g.: getUsers(null, $cols) will return

  1.  $userData[0]['auth_user_id''wujha433gawefawfwfiuj2ou9823r98h';
  2.              ['handle']       'myLogin';
  3.              ['passwd']       'd346gs2gwaeiuhaeiuuweijfjuwaefhj';
  4.              ['myField']      'value';

  • Return: Array with user data or DB error.
  • Access: public

Overrides LiveUser_Admin_Auth_Common::getUsers() (Gets all users with handle, passwd, authId, lastlogin, is_active and individual rights.)

Parameters:

array   $filters   —  filters to apply to fetched data
string   $order   —  if not null 'ORDER BY $order' will be appended to the query
boolean   $rekey   —  will return an associative array with the auth_user_id as the key by using DB::getAssoc() instead of DB::getAll()

[ Top ]

removeUser   [line 227]

mixed removeUser( string $authId)

Removes an existing user from Auth/DB.
  • Return: True on success, DB error if not.
  • Access: public

Overrides LiveUser_Admin_Auth_Common::removeUser() (Removes an existing user from Auth.)

Parameters:

string   $authId   —  Auth user ID of the user that should be removed.

[ Top ]

updateUser   [line 260]

mixed updateUser( string $authId, [string $handle = ''], [string $password = ''], [array $optionalFields = array()], [array $customFields = array()])

Changes user data in auth table.
  • Return: True on success, DB error if not.
  • Access: public

Overrides LiveUser_Admin_Auth_Common::updateUser() (Changes user data in auth table.)

Parameters:

string   $authId   —  Auth user ID.
string   $handle   —  Handle (username) (optional).
string   $password   —  Password (optional).
array   $optionalFields   —  Array of optional fields values to be added array('alias' => ''value')
array   $customFields   —  Array of custom fields values to be updated

[ Top ]


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