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.

updateRole #

Performs a partial update on an existing role.


updateRole(id, content, [options], [callback]) #

ArgumentsTypeDescription
idstringUnique role identifier
contentJSON ObjectA plain JSON object representing the role
optionsstring(Optional) Optional arguments
callbackfunction(Optional) Callback handling the response

Options #

FilterTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue
refreshstringIf set to wait_for, Kuzzle will wait for the persistence layer to finish indexing (available with Elasticsearch 5.x and above)undefined

Return Value #

Returns the Security object to allow chaining.


Callback Response #

Returns an updated Role object.

Usage #

var roleDefinition = {
  controllers: {
    "read": {
      actions: {
        "get": true
      }
    }
  }
};
// Using callbacks (NodeJS or Web Browser)
kuzzle
  .security
  .updateRole("role ID", roleDefinition, function (err, updatedRole) {
    // "updatedRole" is an instance of a Role object
  });
// Using promises (NodeJS)
kuzzle
  .security
  .updateRolePromise("profile ID", roleDefinition)
  .then(updatedRole => {
    // "updatedRole" is an instance of a Role object
  });