createOrReplaceRole method

Future<KuzzleRole> createOrReplaceRole(
  1. String id,
  2. Map<String, dynamic> controllers, {
  3. bool? waitForRefresh,
  4. bool? force,
})

Creates a new role or, if the provided role identifier already exists, replaces it.

Implementation

Future<KuzzleRole> createOrReplaceRole(
  String id,
  Map<String, dynamic> controllers, {
  bool? waitForRefresh,
  bool? force,
}) async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'createOrReplaceRole',
    uid: id,
    force: force,
    waitForRefresh: waitForRefresh,
    body: <String, dynamic>{
      'controllers': controllers,
    },
  ));

  return KuzzleRole.fromKuzzleResponse(kuzzle, response);
}