replaceUser #
Replaces a user with new configuration.
replaceUser(kuid, body, [options]);
Property | Type | Description |
---|---|---|
kuid | string | User kuid |
body | object | User content |
options | object | Query options |
body #
mandatory properties
Property | Type | Description |
---|---|---|
profileIds | array<string> | Profile identifiers to assign the user to |
other properties
The body can be extended with any custom information. Make sure to update the user mapping collection to match your custom attributes.
example:
{
profileIds: [ 'default' ],
firstName: 'John',
lastName: 'Doe'
}
options #
Property | Type (default) | Description |
---|---|---|
queuable | boolean ( true ) | If true , queues the request during downtime, until connected to Kuzzle again |
refresh | boolean ( false ) | If set to wait_for , Kuzzle will not respond until the created user is indexed |
timeout | number ( -1 ) | Time (in ms) during which a request will still be waited to be resolved. Set it -1 if you want to wait indefinitely |
triggerEvents | boolean ( false ) | If set to true , will trigger events even if using Embeded SDK. You should always ensure that your events/pipes does not create an infinite loop. Available since Kuzzle 2.31.0 |
Resolves #
An User
object containing information about the updated user.
Usage #
try {
const response = await kuzzle.security.replaceUser('john.doe', {
profileIds: [ 'default' ],
firstName: 'John',
lastName: 'Doe'
});
console.log(response);
/*
User {
_id: 'john.doe',
content:
{ profileIds: [ 'default' ],
firstName: 'John',
lastName: 'Doe',
_kuzzle_info:
{ author: -1,
createdAt: 1561461975256,
updatedAt: null,
updater: null } } }
*/
} catch (e) {
console.error(e);
}
Edit this page on Github(opens new window)