SDK
SDK Dart Null Safety v3.x
2

createProfile #

Creates a new profile.


Copied to clipboard!
Future<KuzzleProfile> createProfile(
    String uid, List<Map<String, dynamic>> policies,
    {bool? waitForRefresh})

Property Type Description
id
String
Profile identifier
policies
List<Map<String, dynamic>>
Profile content
waitForRefresh
bool?

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

Return #

A Profile object representing the created profile.

Usage #

Copied to clipboard!
final result = await kuzzle.security.createProfile(
  'myProfile',
  [
    {
      'roleId': 'default'
    },
    {
      'roleId': 'admin',
      'restrictedTo': [
        {
          'index': 'someindex',
          'collections': [
            'collection1',
            'collection2'
          ]
        }
      ]
    }
  ]
);
/*
Profile {
  _id: 'myProfile',
  policies:
    [ { roleId: 'default' },
      { roleId: 'admin', restrictedTo: [Array] } ] }
*/