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

Request #7781 add possibility for handle aliasing
Submitted: 2006-06-01 09:06 UTC Modified: 2006-08-15 02:08 UTC
From: mahono Assigned:
Status: Closed Package: LiveUser (version CVS)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-06-01 09:06 UTC] mahono (Matthias Nothhaft)
Description: ------------ It would be very useful to have a reliable handle aliasing. It could be provided by a simple option in the storage container configuration, e.g. this way: 'aliasHandles' => array('email', 'auth_user_id') readUserData()'s SQL of all drivers must be extended and as far as I understand also the config option must be added to LiveUser_Auth_Common Test script: --------------- /* Example for MDB2 driver (readUserData() within else block before password check): */ } else { $query .= '('; $query .= $this->alias['handle'] . '=' . $this->dbc->quote($handle, $this->fields['handle']); if (is_array($this->aliasHandles) && count($this->aliasHandles)) { $query .= ' OR ' foreach ($this->aliasHandles as $alias) { $query .= $this->alias[$alias] . '=' . $this->dbc->quote($alias, $this->fields[$alias]); } } $query .= ') '; if (!is_null($this->tables['users']['fields']['passwd'])) { // ...

Comments

 [2006-06-01 09:21 UTC] mahono
forget the code, these should be better lines: if (is_array($this->aliasHandles) && count($this->aliasHandles)) { $query .= '(' . $this->alias['handle'] . '=' . $this->dbc->quote($handle, $this->fields['handle']); $aliases = array(); foreach ($this->aliasHandles as $field) { $aliases[] = $this->alias[$field] . '=' . $this->dbc->quote($field, $this->fields[$field]); } $query .= ' OR ' . implode(' OR ', $aliases) . ') '; } else { $query .= $this->alias['handle'] . '=' . $this->dbc->quote($handle, $this->fields['handle']); }
 [2006-06-09 04:12 UTC] lsmith (Lukas Smith)
I am not sure what you really mean. You want the ability to have multiple columns as the unqiue identifier?
 [2006-06-09 06:53 UTC] mahono
I would like to login using handle (or email or auth_user_id or ..) and passwd. login() / readUserData() could check this "or field1 or field2" to make it work.
 [2006-08-11 10:04 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.
 [2006-08-11 10:06 UTC] lsmith (Lukas Smith)
upsi .. not yet commited ..
 [2006-08-15 02:08 UTC] mahono at php dot net (Matthias Nothhaft)
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. Now really commited. See package.php in CVS