/** * validate if user is allowed to use the software in maintenance mode * * @return bool */ public function validate() { if (Tinebase_Core::inMaintenanceMode()) { $currentAccount = Tinebase_User::getInstance()->getFullUserById($this->getValidData()); if (!$currentAccount->hasRight('Tinebase', Tinebase_Acl_Rights::MAINTENANCE)) { return false; } } return true; }
/** * create new user session * * @param string $loginName * @param string $password * @param Zend_Controller_Request_Abstract $request * @param string $clientIdString * * @return bool * @throws Tinebase_Exception_MaintenanceMode * * TODO what happened to the $securitycode parameter? * -> @param string $securitycode the security code(captcha) */ public function login($loginName, $password, \Zend\Http\Request $request, $clientIdString = NULL) { $authResult = Tinebase_Auth::getInstance()->authenticate($loginName, $password); $accessLog = Tinebase_AccessLog::getInstance()->getAccessLogEntry($loginName, $authResult, $request, $clientIdString); $user = $this->_validateAuthResult($authResult, $accessLog); if (!$user instanceof Tinebase_Model_FullUser) { return false; } if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " Login with username {$accessLog->login_name} from {$accessLog->ip} succeeded."); } if (Tinebase_Core::inMaintenanceMode()) { if (!$user->hasRight('Tinebase', Tinebase_Acl_Rights::MAINTENANCE)) { throw new Tinebase_Exception_MaintenanceMode(); } } Tinebase_AccessLog::getInstance()->setSessionId($accessLog); $this->initUser($user); $this->_updateCredentialCache($user->accountLoginName, $password); $this->_updateAccessLog($user, $accessLog); return true; }
public static function initSyncrotonRegistry() { Syncroton_Registry::setDatabase(Tinebase_Core::getDb()); Syncroton_Registry::setTransactionManager(Tinebase_TransactionManager::getInstance()); Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_')); Syncroton_Registry::set(Syncroton_Registry::LOGGERBACKEND, Tinebase_Core::getLogger()); Syncroton_Registry::set(Syncroton_Registry::SESSION_VALIDATOR, function () { return !Tinebase_Core::inMaintenanceMode(); }); }