Neos\Neos\Domain\Service\UserService::updateUser PHP Method

updateUser() public method

Note: changes to the user's account will not be committed for persistence. Please use addRoleToAccount(), removeRoleFromAccount(), setRolesForAccount() and setUserPassword() for changing account properties.
public updateUser ( User $user ) : void
$user Neos\Neos\Domain\Model\User The modified user
return void
    public function updateUser(User $user)
    {
        $this->partyRepository->update($user);
        $this->emitUserUpdated($user);
    }

Usage Example

 /**
  * Update/adds a user preference
  *
  * @param string $key The key of the preference to update/add
  * @param string $value The value of the preference
  * @return void
  */
 public function updateAction($key, $value)
 {
     // TODO: This should be done in an earlier stage (TypeConverter ?)
     if (strtolower($value) === 'false') {
         $value = false;
     } elseif (strtolower($value) === 'true') {
         $value = true;
     }
     $user = $this->userService->getCurrentUser();
     $user->getPreferences()->set($key, $value);
     $this->userService->updateUser($user);
     $this->throwStatus(204, 'User preferences have been updated');
 }
All Usage Examples Of Neos\Neos\Domain\Service\UserService::updateUser