hasIdentity()) { $data = $auth->getIdentity(); if (!class_exists($authAdapterClassName, true)) { return false; } /** @var $authAdapter Qs_Auth_Adapter_DbTable */ $authAdapter = new $authAdapterClassName(); $authAdapter->setIdentity($data); $result = $auth->authenticate($authAdapter); if ($result->isValid()) { return true; } else { $auth->clearIdentity(); } } return false; } /** * @static * @param string $type * @return bool */ protected static function _switchSession($type) { if (null === self::$_sessionNameBackup) { self::$_sessionNameBackup = session_name(); } $roles = self::_getSessionConfig('rolePostfix'); if (is_array($roles)) { foreach ($roles as $role) { if ($role['currentPagePrefix'] == $type) { $sessionName = __getSessionName($type); __switchSession($sessionName); } } } return true; } protected static function _restoreSession() { if (null !== self::$_sessionNameBackup && self::$_sessionNameBackup != session_name()) { __switchSession(self::$_sessionNameBackup); } return true; } /** * @static * @param string|null $var * @return mixed */ protected static function _getSessionConfig($var = null) { if (null === self::$_sessionConfig) { self::$_sessionConfig = Zend_Registry::get('config')->session->toArray(); } if (null !== $var) { return Qs_Array::get(self::$_sessionConfig, $var); } return self::$_sessionConfig; } }