SDK
SDK Java v2.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.

updateProfile #

Performs a partial update on an existing profile.


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

Arguments Type Description
id string Unique role identifier
policies array of objects List of policies to apply to this profile
options string (Optional) Optional arguments
callback function (Optional) Callback handling the response

Options #

Filter Type Description Default
queuable boolean Make this request queuable or not true
refresh string If 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 #

Return an updated Profile object.

Usage #

Copied to clipboard!
JSONObject[] policies = new JSONObject[]{
  new JSONObject().put("roleId", "myrole"),
  new JSONObject()
    .put("roleId", "default")
    .put("restrictedTo", new JSONArray()
      .put(new JSONObject().put("index", "index1"))
      .put(new JSONObject()
        .put("index", "index2")
        .put("collections", new JSONArray().put("foo").put("bar"))
      )
    )
};
kuzzle
  .security
  .updateProfile("profile ID", policies, new ResponseListener<Profile>() {
    @Override
    public void onSuccess(Profile profile) {
    }
    @Override
    public void onError(JSONObject error) {
    }
  });