Disable User APIedit

Executionedit

Disabling a user can be performed using the security().disableUser() method:

DisableUserRequest request = new DisableUserRequest("disable_user", RefreshPolicy.NONE);
EmptyResponse response = client.security().disableUser(request, RequestOptions.DEFAULT);

Responseedit

The returned EmptyResponse does not contain any fields. The return of this response indicates a successful request.

Asynchronous Executionedit

This request can be executed asynchronously:

client.security().disableUserAsync(request, RequestOptions.DEFAULT, listener); 

The DisableUser request to execute and the ActionListener to use when the execution completes.

The asynchronous method does not block and returns immediately. Once the request has completed the ActionListener is called back using the onResponse method if the execution successfully completed or using the onFailure method if it failed.

A typical listener for a EmptyResponse looks like:

DisableUserRequest request = new DisableUserRequest("disable_user", RefreshPolicy.NONE);
ActionListener<EmptyResponse> listener = new ActionListener<EmptyResponse>() {
    @Override
    public void onResponse(EmptyResponse setUserEnabledResponse) {
        
    }

    @Override
    public void onFailure(Exception e) {
        
    }
};

Called when the execution is successfully completed. The response is provided as an argument.

Called in case of failure. The raised exception is provided as an argument.