PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » LiveUser_Admin » Bug #4357

perm->getUsers() example returns all users

Details

Submitted2005-05-16 10:59 UTC
Fromscragz at hotmail dot com
Assigneddufuz
StatusClosed
PackageLiveUser_Admin
PHP Version4.3.10
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-05-16 10:59 UTC] scragz at hotmail dot com

Description:
------------
I now have everything updated to the latest CVS versions and I think I found an actual non-bogus bug, if only with the examples. In the "Test fetching auth_user_id AND perm_user_id with PERM getUsers()" bit of User.php, the Auth portion is correctly only returning a single user, but the Perm portion is returning all of the users.

Both of these identically named methods appear to be using wildly different filtering schemes which is another problem in itself. Just for kicks I tried using the Auth scheme for the Perm call, and it didn't change anything.

All I need is to get the perm_user_id based on the auth_user_id since getPermUserId() is gone now.

Reproduce code:
---------------
echo 'Perm<br />';
$filter = array(array('filters' => array('perm_user_id' => '3')));
$filter = array(array('cond' => '', 'name' => 'perm_user_id', 'op' => '=', 'value' => '3', 'type' => 'text'));
$user = $admin->perm->getUsers($filter);
if ($user === false) {
echo '<strong>Error on line: '.__LINE__.'</strong><br />';
print_r($admin->getErrors());
} elseif(empty($user)) {
echo 'No user was found.<br />';
} else {
Var_Dump::display($user);
echo '<br />';
}

Expected result:
----------------
string(98) query: SELECT perm_user_id, auth_user_id, auth_container_name, perm_type
FROM liveuser_perm_users
WHERE perm_user_id = 3

array(1) {
0 => array(4) {
perm_user_id => int 3
auth_user_id => string(1) 3
auth_container_name => string(1) 0
perm_type => int 1
}
}

Actual result:
--------------
string(98) query: SELECT perm_user_id, auth_user_id, auth_container_name, perm_type
FROM liveuser_perm_users

array(19) {
0 => array(4) {
perm_user_id => int 1
auth_user_id => string(1) 1
auth_container_name => string(1) 0
perm_type => int 1
}
1 => array(4) {
perm_user_id => int 2
auth_user_id => string(1) 2
auth_container_name => string(1) 0
perm_type => int 1
}
2 => array(4) {
perm_user_id => int 3
auth_user_id => string(1) 3
auth_container_name => string(1) 0
perm_type => int 1
}
3 => array(4) {
perm_user_id => int 4
auth_user_id => string(1) 4
auth_container_name => string(1) 0
perm_type => int 1
}
4 => array(4) {
perm_user_id => int 5
auth_user_id => string(1) 5
auth_container_name => string(1) 0
perm_type => int 1
}
// you get the idea
}

[2005-05-16 19:29 UTC] scragz at hotmail dot com

Maybe I wasn't clear, but all the code and output I posted was from admin example1, and this is a bug on docs/example1/User.php.

I got it working by changing this:

$filter = array(array('filters' => array('perm_user_id' => '3')));

which seems has one too many array levels, to this:

$filter = array('filters' => array('perm_user_id' => '3'));