SDK Java v2.x

searchRoles #

Search for security roles, optionally returning only the roles giving access to the provided controller names.

searchRoles(filters, [options], callback) #

Arguments Type Description
filters JSON Object Optionally contains a "controllers" array listing the controller names used to filter searched roles
options JSON Object Optional parameters
callback function Callback handling the response

Filters #

Filter Type Description Default
controllers array retrieve only roles allowing access to the provided names []

Options #

Option Type Description Default
from number Starting offset 0
queuable boolean Make this request queuable or not true
size number Number of hits to return per page 10

Callback Response #

Return a JSON Object

Usage #

Copied to clipboard!
// optional: retrieve only roles allowing access to the
// provided controller names
JSONObject filter = new JSONObject()
  .put("controllers", new JSONArray()
// optional: result pagination configuration
Options options = new Options();
options.setFrom((long) 0);
options.setSize((long) 42);
  .searchRoles(filter, options, new ResponseListener<SecurityDocumentList>() {
    public void onSuccess(SecurityDocumentList roles) {
      // roles.getDocuments() returns a roles list
      for(Role role : roles.getDocuments()) {
      // roles.getTotal() returns the number of matched roles, regardless of pagination

Callback response:

Copied to clipboard!
  "total": 124,
  "roles": [
    // array of Role