Re: Extending Auth rules with a fixed where clause

From: Date: Tue, 25 May 2004 11:11:33 +0000
Subject: Re: Extending Auth rules with a fixed where clause
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29620@lists.php.net to get a copy of this message
In article <40B1DAC7.603@email.it>, Luca Mariano wrote: > 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? I think it would be more flexible to pass the whole SQL query as an optional parameter in the constructor. Or extend the DB Container (Thus making a new Container implementation) -- Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>

« previous php.pear.dev (#29620) next »