PEAR is archived and read-only

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

Home » Authentication » LiveUser » Bug #1814

adduser does not work in Class: LiveUser_Admin_Perm_Container_DB_Simple

Details

Submitted2004-07-07 18:44 UTC
Fromjack at studiorvb dot com
Assignedlsmith
StatusClosed
PackageLiveUser
PHP Version4.3.7
Roadmaps(Not assigned)

Comments

[2004-07-07 18:44 UTC] jack at studiorvb dot com

Description:
------------
(i'm discovering liveuser, so now knowing that that was not the best way)

Trying to add an user to my right application based on 'admin_example.php' within the example 5, so :
- first adding an user to the 'LiveUser_Admin_Auth_Container_DB'
- then adding to 'LiveUser_Admin_Perm_Container_DB_Medium' (or complex)

the first one succeed, but I never succeeded the second adduser function.

I began with exactly the example code, and then adapted it to my needs and tried to modify some param to add it.

Bug ? As I succeeded with the adduser function of the LiveUser_Admin, I did no code search, sorry ;-)

Reproduce code:
---------------
$objRightsAdminAuth = new
LiveUser_Admin_Auth_Container_DB(
$lu_dsn, $conf['authContainers'][0]
);

$objRightsAdminPerm = new
LiveUser_Admin_Perm_Container_DB_Medium($lu_dsn, $conf);

$objRightsAdminPerm->setCurrentLanguage('FR');

$user_auth_id = $objRightsAdminAuth->addUser('johndoe', 'dummypass', true);

if (DB::isError($user_auth_id)) {
$user_auth_id->getMessage();
//exit;
}

$user_perm_id = $objRightsAdminPerm->addUser($user_auth_id);

echo '$user_id created ' . $user_auth_id . "\n";

Expected result:
----------------
the same user created in auth and perm.

Actual result:
--------------
code above : success for Auth user, and error for perm user.

[2004-07-21 10:36 UTC] smith at backendmedia dot com

This is a bug in the example due to a recent API change. You are missing the second parameter from your addUser call. However the second parameter was defined as optional, but caused an error to be raised if it was not passed. I cleaned that up.

In the future please include a print_r() of the error you got to make debugging easier for us. Thx.

$user_perm_id = $objRightsAdminPerm->addUser($user_auth_id);
if (LiveUser::isError($user_perm_id)) {
print_r($user_perm_id);
}