Dart 2.x

replaceUser

Replaces a user with new configuration.


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

Property Type Description
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

Property Type Description
profileIds
List
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:

Copied to clipboard!
{
  'profileIds': [ 'default' ],
  'firstName': 'John',
  'lastName': 'Doe'
}

Return

An User object containing information about the updated user.

Usage

Copied to clipboard!
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 } } }
  */