liveuser_admin getUsers
| From: | Jeroen Houben | Date: | Fri, 14 Oct 2005 11:46:27 +0000 |
| Subject: | liveuser_admin getUsers | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-21462@lists.php.net to get a copy of this message | ||
Hi,
I have an list of email addresses. For each address I would like to check if a corresponding user exists in Liveuser.
Here's my code:
$lu_admin = LiveUser_Admin::factory($LUOptions);
$lu_admin->setAdminPermContainer();
$lu_admin->setAdminAuthContainer('database');
foreach ($emails as $email) {
$filters = array();
$filters['auth_user_id'] = $email;
$user = $lu_admin->getUsers('perm', $filters, true);
if (!$user) {
// do some stuff
}
}
//note that "auth_user_id" is always unique email address.
This seems to work until we come accross an email that has a corresponding liveuser entry with an auth_container_name set the radius, which is my other auth container (see config below).
I get an error.
["code"]=>
int(-1)
["params"]=>
array(1) {
["msg"]=>
string(40) "Could not create auth container instance"
}
["package"]=>
string(14) "LiveUser_Admin"
["level"]=>
string(9) "exception"
["time"]=>
float(1129290246.5159)
["context"]=>
array(4) {
["file"]=>
string(44) "/usr/local/share/php/pear/LiveUser/Admin.php"
["line"]=>
int(267)
["function"]=>
string(21) "setAdminAuthContainer"
["class"]=>
string(14) "LiveUser_Admin"
}
["message"]=>
string(58) "An error occurred Could not create auth container instance"
My config:
$LUOptions = array(
'login' => array(
'force' => true), 'logout' => array( 'destroy' => true, ), // authentication container are used to check username / password combos 'authContainers' => array( // first container, check if user can be authenticated against TERENA Radius server 'radius' => array( 'type' => "PEARAuth", 'pearAuth' => $terena_auth_radius ), // second container, check if user can be authenticated against users table (standard part of PEAR::Liveuser) 'database' => array(
'type' => 'DB', 'loginTimeout' => 0, 'expireTime' => 3600, 'idleTime' => 1800,'updateLastLogin' => false, 'allowDuplicateHandles' => false, 'allowEmptyPasswords' => false, 'passwordEncryptionMode' => 'PLAIN', 'storage' => array( 'dsn' => LIVEUSER_DSN, 'prefix' => 'lu_', 'alias' => array( 'lastlogin' => 'lastlogin', 'is_active' => 'is_active', ), 'tables' => array( 'users' => array( 'fields' => array(
'lastlogin' => false, 'is_active' => false,), ), ), 'fields' => array(
'lastlogin' => 'timestamp', 'is_active' => 'boolean',), ), ), ), 'permContainer' => array( 'type' => 'Medium', 'storage' => array( 'DB' => array( 'dsn' => LIVEUSER_DSN, 'prefix' => 'lu_', ) ), ), );