src/wcmf/application/controller/UserController.php
public function setConfigValue() {
    $this->requireTransaction();
    $session = $this->getSession();
    $request = $this->getRequest();
    $response = $this->getResponse();
    $persistenceFacade = $this->getPersistenceFacade();

    // load model
    $authUser = $this->principalFactory->getUser($session->getAuthUser());
    if ($authUser) {
      $configKey = $request->getValue('name');
      $configValue = $request->getValue('value');

      // find configuration
      $configObj = null;
      $configList = Node::filter($authUser->getValue('UserConfig'), null, null,
              ['name' => $configKey]);
      if (sizeof($configList) > 0) {
        $configObj = $configList[0];
      }
      else {
        $configObj = $persistenceFacade->create('UserConfig');
        $configObj->setValue('name', $configKey);
        $authUser->addNode($configObj);
      }

      // set value
      if ($configObj != null) {
        $configObj->setValue('value', $configValue);
      }
    }

    // success
    $response->setAction('ok');
  }
public function setConfigValue() {
    $this->requireTransaction();
    $session = $this->getSession();
    $request = $this->getRequest();
    $response = $this->getResponse();
    $persistenceFacade = $this->getPersistenceFacade();

    // load model
    $authUser = $this->principalFactory->getUser($session->getAuthUser());
    if ($authUser) {
      $configKey = $request->getValue('name');
      $configValue = $request->getValue('value');

      // find configuration
      $configObj = null;
      $configList = Node::filter($authUser->getValue('UserConfig'), null, null,
              ['name' => $configKey]);
      if (sizeof($configList) > 0) {
        $configObj = $configList[0];
      }
      else {
        $configObj = $persistenceFacade->create('UserConfig');
        $configObj->setValue('name', $configKey);
        $authUser->addNode($configObj);
      }

      // set value
      if ($configObj != null) {
        $configObj->setValue('value', $configValue);
      }
    }

    // success
    $response->setAction('ok');
  }
public function setConfigValue ( ) { $ this -> requireTransaction ( ) ; $ session = $ this -> getSession ( ) ; $ request = $ this -> getRequest ( ) ; $ response = $ this -> getResponse ( ) ; $ persistenceFacade = $ this -> getPersistenceFacade ( ) ; // load model $ authUser = $ this -> principalFactory -> getUser ( $ session -> getAuthUser ( ) ) ; if ( $ authUser ) { $ configKey = $ request -> getValue ( 'name' ) ; $ configValue = $ request -> getValue ( 'value' ) ; // find configuration $ configObj = null ; $ configList = Node :: filter ( $ authUser -> getValue ( 'UserConfig' ) , null , null , [ 'name' => $ configKey ] ) ; if ( sizeof ( $ configList ) > 0 ) { $ configObj = $ configList [ 0 ] ; } else { $ configObj = $ persistenceFacade -> create ( 'UserConfig' ) ; $ configObj -> setValue ( 'name' , $ configKey ) ; $ authUser -> addNode ( $ configObj ) ; } // set value if ( $ configObj != null ) { $ configObj -> setValue ( 'value' , $ configValue ) ; } } // success $ response -> setAction ( 'ok' ) ; }
Set a configuration for the user

| Parameter    | Description
|--------------|-----------------------------
| _in_ `name`  | The configuration name
| _in_ `value` | The configuration value
Set a configuration for the user