public function preDispatch() { parent::preDispatch(); // do something before the action is called //-> see Zend Framework $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { // We have a login session (user is logged in) $this->view->person = $this->person = $auth->getIdentity(); $this->view->societe = $this->societe = \Object\Societe::getById($this->person->getSociete()->getId()); } else { $this->forward("form-login", "login"); } }
public function preDispatch() { parent::preDispatch(); // do something before the action is called //-> see Zend Framework \Pimcore\Tool\Authentication::authenticateSession(); $adminSession = new \Zend_Session_Namespace("pimcore_admin"); if (!$adminSession->user instanceof \User) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { // We have a login session (user is logged in) $this->view->person = $this->person = $auth->getIdentity(); $this->view->societe = $this->societe = \Object\Societe::getById($this->person->getSociete()->getId()); } else { $this->forward("form-login", "login"); } } else { $this->view->person = $this->person = \Object\Person::getById(248); $this->view->societe = $this->societe = \Object\Societe::getById($this->person->getSociete()->getId()); } }