Beispiel #1
0
 public function executeChangeRole($request)
 {
     $this->form = new ChangeRoleForm(array(), array('actual_user' => $this->getUser()));
     $values = $request->getParameter($this->form->getName());
     if (isset($values['roles']) && !empty($values['roles'])) {
         $this->getUser()->clearCredentials();
         $new_login_role = sfGuardGroupPeer::retrieveByPK($values['roles']);
         $this->getUser()->setLoginRole($new_login_role->getName());
         //die(var_dump($this->getUser()->getAttribute('login_role')));
         $this->getUser()->addCredentials(sfGuardPermissionPeer::retrieveAllCredentialsForARole(sfGuardGroupPeer::retrieveByName($this->getUser()->getLoginRole())));
     }
     return $this->redirect("mainBackend/index");
 }