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 followed by the save method.

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


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

Arguments Type Description
content JSON Object New role content
options JSON Object Optional parameters
callback function Optional callback handling the response

Options

Option Type Description Default
queuable boolean Make this request queuable or not true

Return Value

Returns the Role object to allow chaining.


Callback Response

Returns the updated version of this object.

Usage

Copied to clipboard!

JSONObject roleDefinition = new JSONObject()
  .put("controllers", new JSONObject()
    .put("document", new JSONObject()
      .put("actions", new JSONObject()
        .put("get", true)
      )
    )
  )
);

role.update(roleDefinition, new ResponseListener<Role>() {
  @Override
  public void onSuccess(Role updatedRole) {

  }

  @Override
  public void onError(JSONObject error) {

  }
});