async checkRights(request) {
    const userId = request.getString("userId");
    const requestPayload = request.getBody();

    if (typeof requestPayload.controller !== "string") {
      throw kerror.get("api", "assert", "missing_argument", "body.controller");
    }

    if (typeof requestPayload.action !== "string") {
      throw kerror.get("api", "assert", "missing_argument", "body.action");
    }

    const user = await global.kuzzle.ask("core:security:user:get", userId);

    const allowed = await user.isActionAllowed(new Request(requestPayload));

    return {
      allowed,
    };
  }
Checks if an API action can be executed by a user