public static function checkLDAP () { $result = AuthenticationConfigurationTable::instance()->getAuthenticationType(); if($result[0]->getAuthenticationtype() == 'DATABASE_LDAP') { return 'false'; } else { return 'true'; } }
/** * * Saves SystemSettings to additional Tables in database * @param sfWebRequest $request * @return <type> */ public function executeSaveSystem(sfWebRequest $request) { $sysObj = new SystemSetting(); $data = $request->getPostParameters(); // save auth settings if (isset($data['authentication_type'])) { if($data['authentication_type'] == 'DBONLY') { AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabase($data); } elseif ($data['authentication_type'] == 'DATABASE_LDAP') { AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabaseAndLDAP($data); } else { AuthenticationConfigurationTable::instance()->updateAuthenticationConfigurationCuteflowDatabaseAndOpenId($data); } } // save systemsetting if (isset($data['systemsetting_language'])) { $data = $sysObj->buildSystemSetting($data); SystemConfigurationTable::instance()->updateSystemConfiguration($data); } // store Email tab if (isset($data['emailtab_emailtype'])) { $data = $sysObj->buildEmailSetting($data); EmailConfigurationTable::instance()->updateEmailConfiguration($data); } // store user tab if (isset($data['userTab_defaultdurationtype'])) { $data = $sysObj->buildUserSetting($data); UserConfigurationTable::instance()->updateUserConfiguration($data); } // save authorization if(isset($data['authorizationTab_hiddenpanel'])) { AuthorizationConfigurationTable::instance()->setAuthorizationConfigurationToNull(); $items = $data['authorizationTab']; foreach ($items as $item => $key) { $item_data = array(); $item_data = explode('__', $item); AuthorizationConfigurationTable::instance()->updateAuthorizationConfigurationById($item_data[0],$item_data[1]); } } // save theme if(isset($data['guitab_theme'])) { UserConfigurationTable::instance()->updateTheme($data['guitab_theme']); } // store useragent settings tab if(isset($data['useragent_useragentsettings']) OR isset($data['useragent_useragentcreation'])) { $data = $sysObj->prepareUserAgentData($data); SystemConfigurationTable::instance()->updateUserAgent($data); } else { $data['useragent_useragentsettings'] = 0; $data['useragent_useragentcreation'] = 0; $data['writeDays'] = 0; } SystemConfigurationTable::instance()->updateUserAgent($data); // save worklfow config WorkflowConfigurationTable::instance()->deleteSettings(); $worklfow = $data['worklfow']; $position = 1; foreach($worklfow as $item => $key) { $workflow = new WorkflowConfiguration(); $workflow->setColumntext($item); $workflow->setIsactive($key); $workflow->setPosition($position++); $workflow->save(); } $this->renderText('{success:true}'); return sfView::NONE; }
/** * Loads firstlogin flag * * @return bool true/false */ public static function getFirstLogin() { $result = AuthenticationConfigurationTable::instance()->getFirstLogin()->toArray(); return $result[0]['firstlogin']; }
/** * Function allows LinkLogin by an email and redirects to the needed actions * the redirect depends on systemsettings. it allows direct linklogin without authentication using loginmask * other possibility is, if no session is set using emaillogin, loginmask is shown and user needs to login * to fill the workflow * * @param sfWebRequest $request * @return <type> */ public function executeLinklogin(sfWebRequest $request) { $settings = AuthenticationConfigurationTable::instance()->getAuthenticationConfiguration()->toArray(); $user_id = $request->getParameter('userid'); if($settings[0]['allowdirectlogin'] == 1) { // allow direct login, without using login form $userLogin = UserLoginTable::instance()->findUserById($user_id); $arr = $userLogin->toArray(); // load User Data if($this->getUser()->isAuthenticated() == false) { // check if user is already logged in if(empty($arr) == false) { // a user has been found, -> user is not deleted $settings = UserSettingTable::instance()->getUserSettingById($user_id); // user is not logged in, set the settings $this->getUser()->setAuthenticated(true); $this->getUser()->setAttribute('id',$user_id); $this->getUser()->setAttribute('userrole',$userLogin[0]->getRoleId()); $this->getUser()->setCulture($settings[0]->getLanguage()); $this->getUser()->setAttribute('env', str_replace('/', '', $request->getScriptName())); $this->redirect($this->generateUrl('default', array('module' => 'layout', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window')))); } else { // user is not found or is deleted $this->redirect('login/index'); } } else { // user is already logged in $this->redirect($this->generateUrl('default', array('module' => 'layout', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window')))); } } else { // allow direct login is denied if($this->getUser()->isAuthenticated() == true) { // user is already logged in $this->redirect($this->generateUrl('default', array('module' => 'layout', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window')))); } else { // move to login page $this->redirect($this->generateUrl('default', array('module' => 'login', 'action' => 'index', 'versionid' => $request->getParameter('versionid'), 'workflow' => $request->getParameter('workflowid'), 'window' => $request->getParameter('window')))); } } return sfView::NONE; }