SDK
SDK Jvm v1.x
2

checkRights #

Available since Kuzzle 2.8.0
Available since 1.1.0

Using the current authentication information, verify if the network connection can execute the required API request.

:::: tabs ::: tab Java

public CompletableFuture<boolean> checkRights(
  Map<String, Object> requestPayload) throws NotConnectedException, InternalException
PropertyTypeDescription
requestPayload
Map<String, Object>
Contains a RequestPayload

requestPayload #

The RequestPayload must contain at least the following properties:

  • controller: API controller
  • action: API action

Returns #

Returns a boolean indicating whether the provided request would have been allowed or not

Usage #

Map<String, Object> body = new HashMap<>();
body.put("name", "Melis");
Map<String, Object> requestPayload = new HashMap<>();
requestPayload.put("controller", "document");
requestPayload.put("action", "create");
requestPayload.put("index", "nyc-open-data");
requestPayload.put("collection", "yellow-taxi");
requestPayload.put("body", body);
Boolean result =
  kuzzle.getAuthController().checkRights(requestPayload).get();

::: ::: tab Kotlin

 fun checkRights(
      requestPayload: Map<String, Any?>): CompletableFuture<Boolean>
PropertyTypeDescription
requestPayload
Map<String, Any?>
Contains a RequestPayload

requestPayload #

The RequestPayload must contain at least the following properties:

  • controller: API controller
  • action: API action

Returns #

Returns a boolean indicating whether the provided request would have been allowed or not

Usage #

val body = HashMap<String, Any?>().apply {
  put("name", "Melis")
}
val requestPayload = HashMap<String, Any?>().apply {
  put("controller", "document")
  put("action", "create")
  put("index", "nyc-open-data")
  put("collection", "yellow-taxi")
  put("body", body)
}
val result = kuzzle.authController.checkRights(requestPayload).get()

::: ::::