Re: liveuser_admin getUsers

From: Date: Fri, 14 Oct 2005 12:14:18 +0000
Subject: Re: liveuser_admin getUsers
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21465@lists.php.net to get a copy of this message
Jeroen Houben wrote:
Lukas Smith wrote:
Jeroen Houben wrote:
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.
Hmm not much we can reasonably do here. Only solutions I can think of are kinda hacky. So all you can do is create a dummy container for the radius stuff.
Basically all I want to do is SELECT * FROM "perm_users" WHERE auth_user_id=? I've now found a way still using the Liveuser_Admin API:
    $params = array();
$params['filters']['auth_user_id'] = $email; $params['select'] = 'row'; $user = $lu_admin->perm->getUsers($params);
    
Don't know why I hadn't thought of that. There often seem to be multiple ways of doing things in Liveuser_Admin, which can be a bit confusing, but maybe that's just me..
You can also search by "auth". This way it will only search in the currently set auth container. regards, Lukas

« previous php.pear.general (#21465) next »