Thank you very much for your advices Hector.
I have one more question, is anything changing on models management using 
multidb?
How do a model know which database resource must use?
Thanks


Sergio 




From: [email protected]
Date: Tue, 16 Mar 2010 09:23:26 -0700
Subject: Re: [fw-general] Using an external database for user credential
To: [email protected]
CC: [email protected]

Take a look at the "multidb" resource:
http://framework.zend.com/manual/en/zend.application.available-resources.html


You could then inject your authentication adapter with the correct db:
// in controller

$db = 
$this->getInvokeArg('bootstrap')->getResource('multidb')->getDb('db2')$authAdapter
 = new Zend_Auth_Adapter_DbTable(

    $db,    $tabUsers,    'username',

    'password');


This would eliminate the need for you to construct your own db adapter from the 
config.
Also, you'll want to use boolean false for isDefaultTableAdapter -- when it's 
set to true, that db instance will be used for all Zend_Db_Table instances by 
default.


--
Hector



On Tue, Mar 16, 2010 at 2:34 AM, Sergio Rinaudo <[email protected]> 
wrote:







Hello, 
I am in a situation where I have to use an external database to check 
credential for user.
Is there any right way to do this in the application ini?

I thoughts something like

  resources.db2.adapter = // external db adapter


  resources.db2.params.host = // external db host
  resources.db2.params.username = // external db user
  resources.db2.params.password = // external db pass
  resources.db2.params.dbname = // external db name


  resources.db2.isDefaultTableAdapter =  // what am I supposed to put here?
  resources.db2.params.charset = UTF8
  resources.db2.profiler.enabled = true

Save it in the registry whitin bootstrap

$db2 = // some code


$registry->db2 = $db2;

Use $db2 to check credential in auth controller

$db2 = Zend_Registry::get('db2');
$authAdapter = new Zend_Auth_Adapter_DbTable(
          $db2,
          $tabUsers,


          'username',
          'password',
          "SHA1(CONCAT('".$salt."',?)) AND status_id = '".$status_id."' "
      );


Is that a correct way to do or there is something better?


Thanks in advance for all your advices.



Sergio 




                                          
Lo spazio su Hotmail aumente con le tue esigenze... Vai oltre i 5GB



                                          
_________________________________________________________________
Più spazio per le tue esigenze. Hotmail va oltre i 5GB
http://www.windowslive.it/hotmail/SpazioDisponibile.aspx

Reply via email to