public function roles()
    {
	    $currentSession = $this->getSession();
	    if ($currentSession instanceof \common_session_RestrictedSession) {
	        $this->setData('roles', $currentSession->getUserRoles());
	        $this->setView('userdebug/restore.tpl');
	    } else {
	        $myFormContainer = new UserDebugRoles();
	        $myForm = $myFormContainer->getForm();
	        if($myForm->isSubmited() && $myForm->isValid()){
				$user = $this->getUserService()->getCurrentUser();
				$filter = $myForm->getValue('rolefilter');
				$userUri = $myForm->getValue('user');
				if ($userUri != $currentSession->getUserUri()) {
				    throw new \common_exception_Error('Security exception, user to be changed is not the current user');
				}
				$session = new \common_session_RestrictedSession($this->getSession(), $myForm->getValue('rolefilter'));
				\common_session_SessionManager::startSession($session);
				$this->setData('roles', $currentSession->getUserRoles());
				$this->setView('userdebug/restore.tpl');
	        } else {
    	        $this->setData('formTitle'	, __("Restrict Roles"));
    	        $this->setData('myForm'		, $myForm->render());

    	        $this->setView('form.tpl', 'tao');
	        }
	    }
	}
public function roles()
    {
	    $currentSession = $this->getSession();
	    if ($currentSession instanceof \common_session_RestrictedSession) {
	        $this->setData('roles', $currentSession->getUserRoles());
	        $this->setView('userdebug/restore.tpl');
	    } else {
	        $myFormContainer = new UserDebugRoles();
	        $myForm = $myFormContainer->getForm();
	        if($myForm->isSubmited() && $myForm->isValid()){
				$user = $this->getUserService()->getCurrentUser();
				$filter = $myForm->getValue('rolefilter');
				$userUri = $myForm->getValue('user');
				if ($userUri != $currentSession->getUserUri()) {
				    throw new \common_exception_Error('Security exception, user to be changed is not the current user');
				}
				$session = new \common_session_RestrictedSession($this->getSession(), $myForm->getValue('rolefilter'));
				\common_session_SessionManager::startSession($session);
				$this->setData('roles', $currentSession->getUserRoles());
				$this->setView('userdebug/restore.tpl');
	        } else {
    	        $this->setData('formTitle'	, __("Restrict Roles"));
    	        $this->setData('myForm'		, $myForm->render());

    	        $this->setView('form.tpl', 'tao');
	        }
	    }
	}
public function roles ( ) { $ currentSession = $ this -> getSession ( ) ; if ( $ currentSession instanceof \ common_session_RestrictedSession ) { $ this -> setData ( 'roles' , $ currentSession -> getUserRoles ( ) ) ; $ this -> setView ( 'userdebug/restore.tpl' ) ; } else { $ myFormContainer = new UserDebugRoles ( ) ; $ myForm = $ myFormContainer -> getForm ( ) ; if ( $ myForm -> isSubmited ( ) && $ myForm -> isValid ( ) ) { $ user = $ this -> getUserService ( ) -> getCurrentUser ( ) ; $ filter = $ myForm -> getValue ( 'rolefilter' ) ; $ userUri = $ myForm -> getValue ( 'user' ) ; if ( $ userUri != $ currentSession -> getUserUri ( ) ) { throw new \ common_exception_Error ( 'Security exception, user to be changed is not the current user' ) ; } $ session = new \ common_session_RestrictedSession ( $ this -> getSession ( ) , $ myForm -> getValue ( 'rolefilter' ) ) ; \ common_session_SessionManager :: startSession ( $ session ) ; $ this -> setData ( 'roles' , $ currentSession -> getUserRoles ( ) ) ; $ this -> setView ( 'userdebug/restore.tpl' ) ; } else { $ this -> setData ( 'formTitle' , __ ( "Restrict Roles" ) ) ; $ this -> setData ( 'myForm' , $ myForm -> render ( ) ) ; $ this -> setView ( 'form.tpl' , 'tao' ) ; } } }
Action dedicated to fake roles
Action dedicated to fake roles