예제 #1
0
 private function _objectToRow(User_Model_Staffmembre $user)
 {
     $userRow['usm_id'] = $user->getId();
     $userRow['usm_firstname'] = $user->getFirstname();
     $userRow['usm_lastname'] = $user->getLastname();
     $userRow['usm_email'] = $user->getEmail();
     $userRow['usm_login'] = $user->getLogin();
     $userRow['usm_password'] = $user->getPassword();
     $userRow['ut_id'] = $user->getTeam();
     if ($user->getTeam() instanceof User_Model_Team) {
         $userRow['ut_id'] = $user->getTeam()->getId();
     }
     return $userRow;
 }
예제 #2
0
 /**
  * Authenticates a user
  * @param User_Model_Staffmembre $user
  * @return boolean
  */
 public function authenticate(User_Model_Staffmembre $user)
 {
     $authAdapter = new Zend_Auth_Adapter_DbTable();
     $authAdapter->setTableName('user_staffmembre')->setIdentityColumn('usm_login')->setCredentialColumn('usm_password')->setIdentity($user->getLogin())->setCredential($user->getPassword());
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($authAdapter);
     switch ($result->getCode()) {
         case Zend_Auth_Result::SUCCESS:
             $identity = $authAdapter->getResultRowObject(null, 'usm_password');
             $auth->getStorage()->write($identity);
             return true;
             break;
         default:
             return false;
     }
 }