Extending Auth rules with a fixed where clause
| From: | Luca Mariano | Date: | Mon, 24 May 2004 11:21:43 +0000 |
| Subject: | Extending Auth rules with a fixed where clause | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-29605@lists.php.net to get a copy of this message | ||
Hi PEARers,
while using the Auth package with the DB container I often need to extend the SELECT clause in fetchData() method in order to check additional conditions on the db record...
A simple solution to this problem is adding an option to the options array (whereclause) + parsig of the new options into fetchData().
This way a params() array like this:
$params = array(
"dsn" => $dsn,
"table" => "users",
"usernamecol" => "login",
"passwordcol" => "password",
"whereclause" => "realm=".$realm
);
will produce a select query like:
SELECT * FROM users WHERE realm=3 AND login='mylogin';
This only involves a 3 lines modify on Auth/Container/DB.php.
What do you think about this?
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=&d=24-5