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.

update #

Updates the role object in Kuzzle.

Unlike a regular document update, this method will replace the whole role definition under the indexes node with the updateContent parameter.
In other words, you always need to provide the complete role definition in the updateContent object.

This method has the same effect as calling [`setContent`](/sdk/js/5/core-classes/role/set-content) followed by the [`save`](/sdk/js/5/core-classes/role/save) method.

To get more information about Kuzzle permissions, please refer to our permissions guide.


update(content, [options], [callback]) #

ArgumentsTypeDescription
contentJSON ObjectNew role content
optionsJSON ObjectOptional parameters
callbackfunctionOptional callback handling the response

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue

Return Value #

Returns the Role object to allow chaining.


Callback Response #

Returns the updated version of this object.

Usage #

var updateContent = {
  controllers: {
    "document": {
      actions: {
        "get": true
      }
    }
  }
};
// Using callbacks (NodeJS or Web Browser)
role.update(updateContent, function(err, updatedRole) {
  // the updatedRole variable is the updated Role object
})
// Using promises (NodeJS)
role
  .updatePromise(updateContent)
  .then(updatedRole => {
    // the updatedRole variable is the updated Role object
  });