updateUser

var newContent = {
  firstname: 'My Name Is',
  lastname: 'Jonas'
};


// Using callbacks (NodeJS or Web Browser)
kuzzle
  .security
  .updateUser("User ID", newContent, function (err, updatedUser) {
    // "updatedUser" is an instance of a User object
  });

// Using promises (NodeJS)
kuzzle
  .security
  .updateUserPromise("User ID", newContent)
  .then(updatedUser => {
    // "updatedUser" is an instance of a User object
  });
JSONObject newContent = new JSONObject()
  .put("firstname", "My Name Is")
  .put("lastname", "Jonas");

kuzzle
  .security
  .updateUser("User ID", newContent, new ResponseListener<User>() {
    @Override
    public void onSuccess(User user) {

    }

    @Override
    public void onError(JSONObject error) {

    }
  });
<?php

use \Kuzzle\Kuzzle;
use \Kuzzle\Security\User;

$kuid = 'myUser';
$userDefinition = [
  'firstname' => 'My Name Is',
  'lastname' => 'Jonas'
];

$kuzzle = new Kuzzle('localhost');
$security = $kuzzle->security();

try {
  $user = $security->updateUser($kuid, $userDefinition);

  // $user instanceof User
}
catch (ErrorException $e) {

}

Performs a partial update on an existing user.


updateUser(id, content, [options], [callback])

ArgumentsTypeDescription
idstringUnique user identifier
contentJSON ObjectA plain JSON object representing the user
optionsstring(Optional) Optional arguments
callbackfunction(Optional) Callback handling the response

Options

FilterTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue

Return value

Returns the Security object to allow chaining.


Callback response

Resolves to an updated User object