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

Class: LiveUser_Admin

Source Location: /LiveUser_Admin-0.1.0/Admin.php

Class Overview


Attempt at a unified admin class


Author(s):

  • Lukas Smith
  • Arnaud Limbourg

Version:

  • $Id: Admin.php,v 1.19 2004/12/18 22:05:27 lsmith Exp $

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 55]
Attempt at a unified admin class

Simple usage:

  1.  $admin = new LiveUser_Admin::factory($conf);
  2.  $found $admin->getUser(3);
  3.  
  4.  if ($found{
  5.   var_dump($admin->perm->getRights());
  6.  }

  • Author: Lukas Smith
  • Author: Arnaud Limbourg
  • Author:
  • Version: $Id: Admin.php,v 1.19 2004/12/18 22:05:27 lsmith Exp $
  • See: LiveUser::factory()


[ Top ]


Class Variables

$auth =  null

[line 88]

Auth admin object
  • Access: public

Type:   object


[ Top ]

$authContainerName =

[line 64]

Name of the current selected auth container
  • Access: public

Type:   string


[ Top ]

$perm =  null

[line 80]

Admin perm object
  • Access: public

Type:   object


[ Top ]



Method Detail

LiveUser_Admin (Constructor)   [line 122]

LiveUser_Admin LiveUser_Admin( )


[ Top ]

addErrorLog   [line 170]

boolean addErrorLog( Log &$log)

Add error logger for use by Errorstack.

Be aware that if you need add a log at the beginning of your code if you want it to be effective. A log will only be taken into account after it's added.

Sample usage:

  1.  $lu_object &LiveUser_Admin::singleton($conf);
  2.  $logger &Log::factory('mail''bug@example.com',
  3.       'myapp_debug_mail_log'array('from' => 'application_bug@example.com'));
  4.  $lu_object->addErrorLog($logger);

  • Return: true on success or false on failure
  • Access: public

Parameters:

Log   &$log   —  logger instance

[ Top ]

addUser   [line 388]

mixed addUser( string $handle, string $password, [array $optionalFields = array()], [array $customFields = array()], [int $id = null], [integer $type = LIVEUSER_USER_TYPE_ID])

Tries to add a user to both containers.

If the optional $id parameter is passed it will be used for both containers.

In any case the auth and perm id will be equal when using this method.

If this behaviour doesn't suit your needs please consider using directly the concerned method. This method is just implement to simplify things a bit and should satisfy most user needs.

Note type is optional for DB, thus it's needed for MDB and MDB2, we recommend that you use type even though you use DB, so if you change to MDB[2], it will be no problem for you. usage example for addUser:

  1.        $optional = array('is_active' => true);
  2.        $user_id $admin->addUser('johndoe''dummypass'$optional);

Untested: it most likely doesn't work.

  • Return: userid or false
  • Access: public

Parameters:

string   $handle   —  user handle (username)
string   $password   —  user password
array   $optionalFields   —  values for the optional fields
array   $customFields   —  values for the custom fields
int   $id   —  ID
integer   $type   —  permission user type

[ Top ]

factory   [line 183]

object &factory( $conf)

  • Access: public

Parameters:

   $conf   — 

[ Top ]

getErrors   [line 592]

array getErrors( )

Wrapper method to get the Error Stack
  • Return: an array of the errors
  • Access: public

[ Top ]

getUser   [line 550]

mixed getUser( mixed $permId, [ $permFilter = array()], [ $authFilter = array()], [ $permOptions = array()])

Finds and gets userinfo by his userID, customFields can also be gotten

Untested: it most likely doesn't work.

  • Return: Array with userinfo if found else error object
  • Access: public

Parameters:

mixed   $permId   —  Perm User ID
   $permFilter   — 
   $authFilter   — 
   $permOptions   — 

[ Top ]

loadPEARLog   [line 143]

void loadPEARLog( )

This method lazy loads PEAR::Log
  • Access: protected

[ Top ]

removeUser   [line 475]

mixed removeUser( mixed $permId)

Removes user from both containers

Untested: it most likely doesn't work.

  • Return: error object or true
  • Access: public

Parameters:

mixed   $permId   —  Auth ID

[ Top ]

searchUsers   [line 516]

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

Searches users with given filters and returns all users found with their handle, passwd, auth_user_id lastlogin, is_active and the customFields if they are specified

Untested: it most likely doesn't work.

  • Return: error object or array
  • Access: public

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 ]

setAdminAuthContainer   [line 245]

boolean setAdminAuthContainer( string $authName)

Sets the current auth container to the one with the given auth container name

Upon success it will return true. You can then access the auth backend container by using the auth property of this class.

e.g.: $admin->auth->addUser();

  • Return: true upon success, false otherwise
  • Access: public

Parameters:

string   $authName   —  auth container name

[ Top ]

setAdminContainers   [line 309]

boolean setAdminContainers( [mixed $authId = null], [string $authName = null])

Tries to find a user in any of the auth container.

Upon success it will return true. You can then access the backend container by using the auth and perm properties of this class.

e.g.: $admin->perm->updateAuthUserId();

  • Return: true upon success, false otherwise
  • Access: public

Parameters:

mixed   $authId   —  user auth id
string   $authName   —  auth container name

[ Top ]

setAdminPermContainer   [line 282]

boolean setAdminPermContainer( )

Sets the perm container

Upon success it will return true. You can then access the perm backend container by using the perm properties of this class.

e.g.: $admin->perm->addUser();

  • Return: true upon success, false otherwise
  • Access: public

[ Top ]

setConfArray   [line 222]

boolean setConfArray( array $conf)

Merges the current configuration array with configuration array pases along with the method call.
  • Return: true upon success, false otherwise

Parameters:

array   $conf   —  configuration array

[ Top ]

singleton   [line 203]

object &singleton( $conf)

  • Access: public

Parameters:

   $conf   — 

[ Top ]

updateUser   [line 434]

mixed updateUser( integer $permId, string $handle, string $password, [array $optionalFields = array()], [array $customFields = array()], [integer $type = LIVEUSER_USER_TYPE_ID])

Tried to changes user data for both containers.

Note type is optional for DB, thus it's needed for MDB and MDB2, we recommend that you use type even though you use DB, so if you change to MDB[2], it will be no problem for you. usage example for updateUser:

  1.        $optional = array('is_active' => false);
  2.        $admin->updateUser($user_id'johndoe''dummypass');

Untested: it most likely doesn't work.

  • Return: error object or true
  • Access: public

Parameters:

integer   $permId   —  permission user id
string   $handle   —  user handle (username)
string   $password   —  user password
array   $optionalFields   —  values for the optional fields
array   $customFields   —  values for the custom fields
integer   $type   —  permission user type

[ Top ]


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