Witam

Problem polega na tym, że logując się w jednym serwisie automatycznie loguje mnie w drugim (na tym samym serwerze) - chodzi o namespace dla sesji, domyślnie jest Zend_Auth.

UPDATE
Miałem małe 'niedociągnięcie', także już opisuję solucję dla następnych pokoleń winksmiley.jpg

Ponieważ w bootstrapie przekazywałem do plugina (Zend_Acl, celem sprawdzenia jaką ma user ustawioną rolę w db i pobrania zezwoleń z Acl) instancję klasy Zend_Auth, tam powinienem ustawić przestrzeń nazw, a tego nie zrobiłem. Czyli:
  1. <?php
  2. $auth = Zend_Auth::getInstance();
  3. $auth->setStorage(new Zend_Auth_Storage_Session('someNamespace'));
  4. ?>


I dalej już będzie działało jak powinno.
Przepraszam, za kłopot smile.gif

Logowanie wygląda następująco:
  1. <?php
  2. public function indexAction() {
  3.        $auth = Zend_Auth::getInstance();
  4.         //$auth->setStorage(new Zend_Auth_Storage_Session('someNamespace')); - tej linijki nie trzeba tutaj.
  5.  
  6.        if($auth->hasIdentity()) {
  7.            $this->_redirect('/');
  8.        }
  9.  
  10.        $form = new Form_Login($this->akcja);
  11.  
  12.        if($this->_request->isPost()) {
  13.            if($form->isValid($this->_request->getPost())) {
  14.                $dbAdapter = Zend_Db_Table::getDefaultAdapter();
  15.                $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
  16.  
  17.                $authAdapter->setTableName('accounts')
  18.                            ->setIdentityColumn('login')
  19.                            ->setCredentialColumn('password')
  20.                            ->setCredentialTreatment('SHA1(?)')
  21.                            ->setIdentity($this->_request->getPost('login'))
  22.                            ->setCredential($this->_request->getPost('password'));
  23.  
  24.                $result = $auth->authenticate($authAdapter);
  25.  
  26.                if($result->isValid()) {
  27.                    $userInfo = $authAdapter->getResultRowObject(null, 'password');
  28.  
  29.                    $mLogin = new Model_Login;
  30.                    $userInfo->role_id = $mLogin->pobierzRole($userInfo->id);
  31.  
  32.                    $authStorage = $auth->getStorage();
  33.                    $authStorage->write($userInfo);
  34.  
  35.                    $this->_redirect('/admin');
  36.                }
  37.  
  38.                $this->view->error = 'Logowanie nie powiodło się, spróbuj ponownie.';
  39.            }
  40.        }
  41.        $this->view->form = $form;
  42.    }
  43. ?>


Pozdrawiam,
MP