/**
  * startSetupSession
  * 
  * TODO remove redundancy with Tinebase_Core::startCoreSession()
  */
 public static function startSetupSession()
 {
     Tinebase_Session::setSessionBackend();
     Zend_Session::start();
     $setupSession = Setup_Session::getSessionNamespace();
     if (isset($setupSession->setupuser)) {
         self::set(self::USER, $setupSession->setupuser);
     }
     if (!isset($setupSession->jsonKey)) {
         $setupSession->jsonKey = Tinebase_Record_Abstract::generateUID();
     }
     self::set('jsonKey', $setupSession->jsonKey);
 }
 /**
  * create new setup user session
  *
  * @param   string $_username
  * @param   string $_password
  * @return  bool
  */
 public function login($_username, $_password)
 {
     $setupAuth = new Setup_Auth($_username, $_password);
     $authResult = Zend_Auth::getInstance()->authenticate($setupAuth);
     if ($authResult->isValid()) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Valid credentials, setting username in session and registry.');
         Tinebase_Session::regenerateId();
         Setup_Core::set(Setup_Core::USER, $_username);
         Setup_Session::getSessionNamespace()->setupuser = $_username;
         return true;
     } else {
         Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Invalid credentials! ' . print_r($authResult->getMessages(), TRUE));
         Tinebase_Session::expireSessionCookie();
         sleep(2);
         return false;
     }
 }