replaceUser #
Replaces an existing user.
replaceUser(id, content, [options], [callback]) #
Arguments | Type | Description |
---|---|---|
id | string | Unique user identifier |
content | JSON Object | A plain JSON object representing the user, should contain the mandatory profileIds field |
options | string | (Optional) Optional arguments |
callback | function | (Optional) Callback handling the response |
Options #
Filter | Type | Description | Default |
---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
refresh | string | If set to wait_for , Kuzzle will wait for the persistence layer to finish indexing (available with Elasticsearch 5.x and above) | undefined |
Return Value #
Returns the Security
object to allow chaining.
Callback Response #
Returns a User object.
Usage #
<?php
use \Kuzzle\Kuzzle;
use \Kuzzle\Security\User;
$kuid = 'myUser';
$userDefinition = [
'profileIds' => ['admin'],
'firstname' => 'My Name Is',
'lastname' => 'Jonas'
];
$kuzzle = new Kuzzle('localhost');
$security = $kuzzle->security();
try {
$user = $security->replaceUser($kuid, $userDefinition);
// $user instanceof User
}
catch (ErrorException $e) {
}
Edit this page on Github(opens new window)