- Code: Select all
if ($prof=='ADM') $this->getUser()->addCredential('ADM');
elseif ($prof=='STD') $this->getUser()->addCredential('STD');
Is it useful, for security reasons, to connect to the database with login/password acoording to the profile.
In this view, I have defined two connexions in the database.yml file :
- Code: Select all
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: 'pgsql:host=localhost;dbname=geodatabase'
username: standuse
password: ****
doctrine_adm:
class: sfDoctrineDatabase
param:
dsn: 'pgsql:host=localhost;dbname=geodatabase'
username: admuse
password: ****
But, how to use these possibilities :
- in a Doctrine query ?
- Code: Select all
if ($this->getUser()->hasCredential('ADM')) $q = Doctrine_Query::create()->from('Produit');// ...??? doctrine_adm connexion
elseif ($this->getUser()->hasCredential('STD')) $q = Doctrine_Query::create()->from('Produit');// ...??? doctrine connexion
$prods = $q->execute();
- in a view generated with the generator.yml ?
With many thanks
