Introduction to LiveUser Administration

LiveUser_Admin in short...

What?

PEAR::LiveUser_Admin is the administration interface to be used with LiveUser.

It allows you to update the information :

You can also:

Why?

Unless you want to update the database tables manually, you're invited to use the administrative interface.

Where?

The first point of reference is the PEAR site.

You may find more advanced help by visiting the PEAR forum. Although most messages are in German, you may write in English as well or use the build-in translation feature. People there are very responsive and really kind.

Installation

You'll need to install PEAR and some PEAR packages to have the example working. You'll find the list of required stuff below:

Configuration

In order to start using the admin interface, we'll need to adapt somehow the configuration file that was used in the LiveUser example:

  • the 'permContainer' array must be defined and active
  • a link must be made with the LiveUser_Admin class. We will then be able to use it thru the $LUA variable.

Download «conf_admin.php»

Code
getMessage() . ' ' . $db->getUserInfo();
  }

$db->setFetchMode(MDB2_FETCHMODE_ASSOC);

$conf =
    array(
        'debug' => false,
        'session'  => array(
            'name'     => 'PHPSESSION',       // liveuser session name
            'varname'  => 'ludata'            // liveuser session var name
        ),
        'login' => array(
            'force'    => false               // should the user be forced to login
        ),
        'logout' => array(
            'destroy'  => true                // whether to destroy the session on logout
        ),
        'cookie' => array(
            'name' => 'loginInfo',            // name of the Remember me cookie
            'lifetime' => 30,                 // cookie lifetime in days
            'path' => null,                   // cookie path ?
            'domain' => null,                 // cookie domain ?
            'secret' => 'test',
            'savedir' => '.',                 // absolute path to writeable 
                                              // directory (no trailing slash) ?
            'secure' => false,                // whether cookie only send over 
                                              // secure connection
        ),
        'authContainers' => array(
            array(
                'type'          => 'MDB2',    // auth container name
                'expireTime'    => 3600,      // max lifetime of a session in seconds
                'idleTime'      => 1800,      // max time between 2 requests
                'allowEmptyPasswords'   => 0, // does not allow empty passwords
                'passwordEncryptionMode'=> 'MD5',
                'storage' => array(
                    'dsn' => $dsn,
                    'alias' => array(         // contains any additional or 
                                              // non-default field alias
                        'lastlogin' => 'last_login',
                        'is_active' => 'is_active',
                        'owner_user_id' => 'owner_user_id',
                        'owner_group_id' => 'owner_group_id',
                        'email' => 'email'
                    ),
                    'fields' => array(        // contains any additional or 
                                              // non-default field types
                        'lastlogin' => 'timestamp',
                        'is_active' => 'boolean',
                        'owner_user_id' => 'integer',
                        'owner_group_id' => 'integer',
                        'email' => 'text'
                    ),
                    'tables' => array(        // contains additional tables or 
                                              // fields in existing tables
                        'users' => array(
                            'fields' => array(
                                'lastlogin' => false,
                                'is_active' => false,
                                'owner_user_id' => false,
                                'owner_group_id' => false,
                                'email' => false
                            )
                        )
                    )
                )
            )
        ),
        'permContainer' => array(
            'type' => 'Medium',
            'storage' => array(
                'MDB2' => array(              // storage container name
                    'dsn' => $dsn,
                    'prefix' => 'liveuser_',  // table prefix
                    'tables' => array(        // contains additional tables
                                              // or fields in existing tables
                        'groups' => array(
                            'fields' => array(
                                'owner_user_id'  => false,
                                'owner_group_id' => false,
                                'is_active'      => false
                            )
                        )
                    ),
                    'fields' => array(        // contains any additional
                                              // or non-default field types
                        'owner_user_id'  => 'integer',
                        'owner_group_id' => 'integer',
                        'is_active'      => 'boolean'
                    ),
                    'alias'  => array(        // contains any additional
                                              // or non-default field alias
                        'owner_user_id'  => 'owner_user_id',
                        'owner_group_id' => 'owner_group_id',
                        'is_active'      => 'is_active'
                    )
                )
            )
        )
    );

//PEAR::setErrorHandling(PEAR_ERROR_RETURN);

$LU = LiveUser::singleton($conf);

if (!$LU->init())
  {
    var_dump($LU->getErrors());
    die();
  }
$handle = (array_key_exists('handle', $_REQUEST)) ? $_REQUEST['handle'] : null;
$passwd = (array_key_exists('passwd', $_REQUEST)) ? $_REQUEST['passwd'] : null;
$logout = (array_key_exists('logout', $_REQUEST)) ? $_REQUEST['logout'] : false;
$remember = (array_key_exists('rememberMe', $_REQUEST)) ? $_REQUEST['rememberMe'] : false;
if ($logout)
  {
  $LU->logout(false);                       // does not delete the RememberMe cookie
  }
elseif(!$LU->isLoggedIn() || ($handle && $LU->getProperty('handle') != $handle))
  {
  if (!$handle)
    {
    $LU->login(null, null, true);
    }
  else
    {
    $LU->login($handle, $passwd, $remember);
    }
  }
$LUA =& LiveUser_Admin::factory($conf);
$LUA->init();

?>

From now on...

In the following pages, we'll examine some adminitrative methods, used at the simple level permission management.

Some points still need to be documented.

Get in touch!

We'd love to hear from you, what you think about this page or what we can do for you.

Contact Us

View this page with IE8+, Mozilla Firefox, Safari, Chrome and Mobiles

Last modificaton on 21 May 2015 by St├ęphane Van Nerom

© 2006-2014 - GVN - All rights reserved
v2.0.14