Skip to content

Conversation

@tvernum
Copy link
Contributor

@tvernum tvernum commented Nov 16, 2018

The RestHasPrivilegesAction previously handled its own XContent
generation. This change moves that into HasPrivilegesResponse and
makes the response implement ToXContent.

This allows HasPrivilegesResponseTests to be used to test
compatibility between HLRC and X-Pack internals.

A serialization bug (cluster privs) was also fixed here.

Relates: #35479

The RestHasPrivilegesAction previously handled its own XContent
generation. This change moves that into HasPrivilegesResponse and
makes the response implement ToXContent.

This allows HasPrivilegesResponseTests to be used to test
compatibility between HLRC and X-Pack internals.

A serialization bug (cluster privs) was also fixed here.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security

@tvernum
Copy link
Contributor Author

tvernum commented Nov 19, 2018

06:32:32 Caused by: java.io.FileNotFoundException: /tmp/.gradle-test-kit-jenkins/caches/4.10/scripts-remapped/build_5ja2t0gai22z6i9he69emifxd/bierx9xgpipif9vv3my944rer/cp_proj525a2f1efef12369079491b50deb9f6c/metadata/metadata.bin (No such file or directory)

😿

@elasticmachine Please run gradle build tests

this.completeMatch = completeMatch;
this.cluster = new HashMap<>(cluster);
this.index = new ArrayList<>(index);
this.index = sorted(new ArrayList<>(index));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be using a Set in this circumstances.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I was starting from scratch, then so would I, but that would require changing the return types on getIndexPrivileges and getApplicationPrivileges which seemed more invasive than was justified by this PR.

I'm happy to revist that choice if you want - I went back-and-forth many times while making the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good like it is , it's more civilized, otherwise it would indeed indeed violate the scope of this PR. I think I see the privilege code as new code where creative destruction is more loosely permitted.

But I still think it would be nice to do this change in a follow-up. I am happy to pick it up if you wish.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all yours :)

out.writeBoolean(completeMatch);
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
out.writeMap(cluster, StreamOutput::writeString, StreamOutput::writeBoolean);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is the oversight you've mentioned

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I actually noticed it while working on application privileges, but forgot to come back and fix it.

@albertzaharovits
Copy link
Contributor

albertzaharovits commented Nov 19, 2018

Left one note and one suggestion. I think that's all there is here, but I'll scrutinize it again when you ping me again.

@tvernum
Copy link
Contributor Author

tvernum commented Nov 20, 2018

02:14:36 > Could not download elasticsearch-oss.rpm (org.elasticsearch.distribution.rpm:elasticsearch-oss:6.5.0)
02:14:36 See https://docs.gradle.org/4.10/userguide/command_line_interface.html#sec:command_line_warnings
02:14:36    > Could not get resource 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-6.5.0.rpm'.
02:14:36 366 actionable tasks: 366 executed
02:14:36       > Read timed out

@elasticmachine run sample packaging tests

Copy link
Contributor

@albertzaharovits albertzaharovits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tvernum tvernum merged commit 30c5422 into elastic:master Nov 21, 2018
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Nov 26, 2018
The RestHasPrivilegesAction previously handled its own XContent
generation. This change moves that into HasPrivilegesResponse and
makes the response implement ToXContent.

This allows HasPrivilegesResponseTests to be used to test
compatibility between HLRC and X-Pack internals.

A serialization bug (cluster privs) was also fixed here.
tvernum added a commit that referenced this pull request Nov 27, 2018
The RestHasPrivilegesAction previously handled its own XContent
generation. This change moves that into HasPrivilegesResponse and
makes the response implement ToXContent.

This allows HasPrivilegesResponseTests to be used to test
compatibility between HLRC and X-Pack internals.

A serialization bug (cluster privs) was also fixed here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants