SDK
SDK Dart v2.x
2

createProfile #

Creates a new profile.


Future<KuzzleProfile> createProfile(
    String uid, List<Map<String, dynamic>> policies,
    {bool waitForRefresh})

PropertyTypeDescription
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 #

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] } ] }
*/