Enable User APIedit

Executionedit

Enabling a disabled user can be performed using the security().enableUser() method:

EnableUserRequest request = new EnableUserRequest("enable_user", RefreshPolicy.NONE);
EmptyResponse response = client.security().enableUser(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().enableUserAsync(request, RequestOptions.DEFAULT, listener); 

The EnableUser 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:

EnableUserRequest request = new EnableUserRequest("enable_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.