Esempio n. 1
0
 /**
  *
 * Load Userrights and User Id to Sesseion.
 *
 * @param sfRequest $request A request object
 */
 public function executeIndex(sfWebRequest $request) {
     $loginObject = new Login();
     
     /*
     * Load the userrole, userrigths, userSettings, userId, workflowSettings for the logged user and store to session
     */
     $userSettings = UserSettingTable::instance()->getUserSettingById($this->getUser()->getAttribute('id'));
     $userWorkflowSetting = UserWorkflowConfigurationTable::instance()->getSingleUserWorkflowConfigurattion($this->getUser()->getAttribute('id'))->toArray();
     $this->getUser()->setAttribute('userSettings', $userSettings[0]->toArray()); // set userSettings
     $config = SystemConfigurationTable::instance()->getSystemConfiguration()->toArray();
     $this->getUser()->setAttribute('userWorkflowSettings', $loginObject->generateUserWorklowView($userWorkflowSetting, sfContext::getInstance())); // set workflowsettings
     $data = $this->getUser()->getAttribute('userWorkflowSettings');
     $credentials = CredentialTable::instance()->getAllCredentials();
     $userrights = CredentialRoleTable::instance()->getCredentialRoleById($this->getUser()->getAttribute('id'));
     $rights = $loginObject->loadUserRight($credentials, $userrights);
     $this->getUser()->setAttribute('credential', $rights); // set rights and role
     $this->systemConfiguration = $config[0];
     $this->theTheme = $userSettings[0]->getTheme(); // load the users theme
     /*
      * -1 is set when user uses login form to login
      * int is set, when user logges in from en email link, then a workflow needs to opened
      */
     $this->version_id  = $request->getParameter('versionid',-1);
     $this->workflow_id  = $request->getParameter('workflow',-1);
     $this->window  = $request->getParameter('window',-1);
     return sfView::SUCCESS;
 }
Esempio n. 2
0
 /**
 * Changes an Edited Role
 *
 * @param sfWebRequest $request
 * @return <type>
 */
 public function executeEditRole(sfWebRequest $request) {
     $data = $request->getPostParameters();
     CredentialRoleTable::instance()->deleteCredentialRole($this->getRequestParameter('hiddenfield'));
     unset($data['hiddenfield']);
     $values = array_keys($data);
     foreach($values as $item) {
         $rolecredObj = new CredentialRole();
         $rolecredObj->setRoleId($this->getRequestParameter('hiddenfield'));
         $rolecredObj->setCredentialId($item);
         $rolecredObj->save();
     }
     $this->renderText('{success:true}');
     return sfView::NONE;
 }