SDK
SDK Dart v2.x
2

replaceUser #

Replaces a user with new configuration.


Future<KuzzleUser> replaceUser(String id, 
  Map<String, dynamic> body, {bool waitForRefresh})

PropertyTypeDescription
id
String
User id
body
Map<String, dynamic>
User content
waitForRefresh
boolean

(null)
If set to true, Kuzzle will not respond until the created user is indexed

body #

mandatory properties

PropertyTypeDescription
profileIdsList<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'
}

Return #

An User object containing information about the updated user.

Usage #

final result = await kuzzle.security.replaceUser('john.doe', {
  'profileIds': [ 'default' ],
  'firstName': 'John',
  'lastName': 'Doe'
});
/*
User {
  _id: 'john.doe',
  content:
    { profileIds: [ 'default' ],
      firstName: 'John',
      lastName: 'Doe',
      _kuzzle_info:
        { author: -1,
          createdAt: 1561461975256,
          updatedAt: null,
          updater: null } } }
  */