Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.0

Bug #7975 update of auth_user_id not possible in liveuser_perm_users table
Submitted: 2006-06-23 17:12 UTC
From: mahono Assigned: lsmith
Status: Closed Package: LiveUser_Admin (version CVS)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-06-23 17:12 UTC] mahono (Matthias Nothhaft)
Description: ------------ Unfortunately it is not possible to update the auth_user_id using $admin->updateUser($data, $perm_user_id) Only the perm_type is updated. Once I change an auth_user_id, the user disappears because the join/mapping fails. Test script: --------------- I suggest changing the end of updateUser() after ($result===true) check this way (tested and works as expected): if (is_null($type) && !array_key_exists('auth_user_id', $data)) { return true; } $updateData = array(); if ($type) { $updateData['perm_type'] = $type; } if (array_key_exists('auth_user_id', $data) && $permData['auth_user_id'] != $data['auth_user_id'] ) { $updateData['auth_user_id'] = $data['auth_user_id']; } $filters = array('perm_user_id' => $permUserId); return $this->perm->updateUser($updateData, $filters);

Comments

 [2006-06-25 16:40 UTC] mahono
like I said: it works.. but the check (permData['auth_user_id'] != $data['auth_user_id']) should be moved to the "is_null($type) && ..." check so the data will really only get updated if auth_user_id changed to avoid the query if not needed. or simply do a count() check before updateUser() ..?
 [2006-06-25 16:52 UTC] mahono
ok, I think best will be to remove the if (is_null($type) && ...) block (first 4 lines in my code) and insert these lines before the line "$filters = array(...": if (count($updateData) == 0) { return true; }
 [2006-08-07 20:40 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.