SDK
SDK Javascript v5.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

addPolicy #

Adds a role to the security profile.

Updating a security profile will have no impact until the [save](/sdk/js/5/core-classes/profile/save) method is called

addPolicy(id) #

ArgumentsTypeDescription
idstringUnique id of the new role to associate

addPolicy(policy) #

ArgumentsTypeDescription
policyJSON Objectpolicy instance corresponding to the new associated role and its restrictions

Return Value #

Returns the Profile object to allow chaining calls.

Usage #

profile.addPolicy({
  'roleId': 'some role id',
  'restrictedTo': [{index: 'index1'}, {index: 'index2', collections: ['foo', 'bar'] } ]
});