diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java index f39c5682516..d09b168e966 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java @@ -17,6 +17,7 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; +import java.util.Arrays; import java.util.Map; import static org.elasticsearch.action.ValidateActions.addValidationError; @@ -180,4 +181,18 @@ public class PutUserRequest extends ActionRequest implements UserRequest, WriteR } out.writeBytesReference(charBytesRef); } + + @Override + public String toString() { + return "PutUserRequest{" + + "username='" + username + '\'' + + ", roles=" + Arrays.toString(roles) + + ", fullName='" + fullName + '\'' + + ", email='" + email + '\'' + + ", metadata=" + metadata + + ", passwordHash=" + (passwordHash == null ? "" : "") + + ", enabled=" + enabled + + ", refreshPolicy=" + refreshPolicy + + '}'; + } } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/NativeUsersStore.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/NativeUsersStore.java index 1fbb8d1eaa5..f941f560c11 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/NativeUsersStore.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/NativeUsersStore.java @@ -341,7 +341,9 @@ public class NativeUsersStore { new ActionListener() { @Override public void onResponse(UpdateResponse updateResponse) { - assert updateResponse.getResult() == DocWriteResponse.Result.UPDATED; + assert updateResponse.getResult() == DocWriteResponse.Result.UPDATED + || updateResponse.getResult() == DocWriteResponse.Result.NOOP + : "Expected 'UPDATED' or 'NOOP' result [" + updateResponse + "] for request [" + putUserRequest + "]"; clearRealmCache(putUserRequest.username(), listener, false); }