public static function signIn($userName, $password, $rememberMe = false, $md5 = true) { $retVal = false; // set ZendX_Doctrine_Auth_Adapter $auth = Zend_Auth::getInstance(); $authAdapter = new ZendX_Doctrine_Auth_Adapter(Doctrine::getConnectionByTableName('Model_Entity_User')); $password = $md5 ? md5($password) : $password; $authAdapter->setTableName('Model_Entity_User u')->setIdentityColumn('userName')->setCredentialColumn('password')->setCredentialTreatment('? AND active = 1')->setIdentity($userName)->setCredential($password); // set Zend_Auth $result = $auth->authenticate($authAdapter); // Check Auth Validation if ($result->isValid()) { // Remove some fields which are secure! $omitColumns = array('password', 'activationKey', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by'); $identity = $authAdapter->getResultRowObject(null, $omitColumns); $identity->roles = Kebab_Model_User::getUserRoles($identity->id); $identity->acl = new Kebab_Access_Acl(); $identity->stories = Kebab_Model_Story::getUserStoriesName($identity->roles); $auth->getStorage()->write($identity); if ($rememberMe) { Zend_Session::rememberMe(604800); } $retVal = true; } return $retVal; }
/** * @return void */ public function indexAction() { // Mapping $mapping = array('id' => 'story.id', 'active' => 'story.active', 'description' => 'storyTranslation.description', 'title' => 'title'); //KBBTODO move dql to models $ids = $this->_helper->search('Model_Entity_Story', true); $query = Kebab_Model_Story::getStory($ids)->orderBy($this->_helper->sort($mapping)); $pager = $this->_helper->pagination($query); $story = $pager->execute(); // Response $responseData = is_object($story) ? $story->toArray() : array(); $this->_helper->response(true)->addData($responseData)->addTotal($pager->getNumResults())->getResponse(); }
public function indexAction() { $params = $this->_helper->param(); $roleId = $params['roleId']; // Mapping for order $mapping = array('id' => 'story.id', 'title' => 'storyTranslation.title', 'description' => 'storyTranslation.description', 'allow' => 'allow'); $order = $this->_helper->sort($mapping); $ids = $this->_helper->search('Model_Entity_Story', true); $query = Kebab_Model_Story::getStory($ids, $roleId)->orderBy($order); $pager = $this->_helper->pagination($query); $story = $pager->execute(); $responseData = is_object($story) ? $story->toArray() : array(); $this->_helper->response(true)->addData($responseData)->addTotal(count($responseData))->getResponse(); }
/** * Desktop screen * * @return void */ public function desktopAction() { $this->view->stories = Kebab_Model_Story::getUserStoriesName(); $this->view->applications = Kebab_Model_Application::getApplicationsByPermission(); }