-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Serialize application privileges in PutRoleRequest #31712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialize application privileges in PutRoleRequest #31712
Conversation
The serialization methods for `PutRoleRequest` did not handle the applicationPrivileges array. Fixes this and added tests
Pinging @elastic/es-security |
out.writeStringArray(runAs); | ||
refreshPolicy.writeTo(out); | ||
out.writeMap(metadata); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: extra line
final PutRoleRequest copy = new PutRoleRequest(); | ||
copy.readFrom(out.bytes().streamInput()); | ||
|
||
assertThat(copy.roleDescriptor(), equalTo(original.roleDescriptor())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that RoleDescriptor.ApplicationPrivilege#equals
Line 839 in b8d7462
&& Arrays.equals(this.privileges, that.privileges); |
This looks to me as an oversight?
request.cluster(randomSubsetOf(Arrays.asList("monitor", "manage", "all", "manage_security", "manage_ml", "monitor_watcher")) | ||
.toArray(Strings.EMPTY_ARRAY)); | ||
|
||
for (int i = randomIntBetween(1, 4); i > 0; i--) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
randomIntBetween(0, 4), would be more alike to a true request?
|
||
final Supplier<String> stringWithInitialLowercase = () | ||
-> randomAlphaOfLength(1).toLowerCase(Locale.ROOT) + randomAlphaOfLengthBetween(3, 12); | ||
final ApplicationResourcePrivileges[] applicationPrivileges = new ApplicationResourcePrivileges[randomIntBetween(1, 5)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same heere, randomIntBetween(0, 5) would be more life-like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question and 3 nits, OTT LGTM
The serialization methods for
PutRoleRequest
did not handle theapplicationPrivileges array.
Fixes this and added tests