Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 /**
  * Desktop screen
  * 
  * @return void
  */
 public function desktopAction()
 {
     $this->view->stories = Kebab_Model_Story::getUserStoriesName();
     $this->view->applications = Kebab_Model_Application::getApplicationsByPermission();
 }