You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "phrocker (via GitHub)" <gi...@apache.org> on 2024/03/06 18:25:48 UTC
[PR] Fixes FUZE-855: adds a restriction info object that the UI can pull if it is present [accumulo-access]
phrocker opened a new pull request, #67:
URL: https://github.com/apache/accumulo-access/pull/67
I didn't add additional null checks, which could be added as tests into AuthorizationsTests.
It felt less clean to ingest the singular test into AccessExpressionTest or AccessEvaluatorTest, but happy to get feedback. I'm new to this particular project so this is kind of a feeler.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fixes FUZE-855: adds a restriction info object that the UI can pull if it is present [accumulo-access]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on PR #67:
URL: https://github.com/apache/accumulo-access/pull/67#issuecomment-1981935728
> I think there's more value in explicitly throwing an error if a user tries to supply a duplicate authorization, rather than silently remove duplicates.
What the behavior should be in this case is very subjective. My preference would be to dedupe, however I am not opposed to throwing an exception. One interesting thing is that the behavior is inconsistent between the two public static `of()` methods. Currently before this change one method will dedupe while the other throws an exception. It would be nice to make the two methods have consistent behavior, document the behavior for dupes, and test it. Whatever change is made, getting it consistent will be nice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fixes FUZE-855: adds a restriction info object that the UI can pull if it is present [accumulo-access]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #67:
URL: https://github.com/apache/accumulo-access/pull/67#discussion_r1515000521
##########
src/test/java/org/apache/accumulo/access/AuthorizationTest.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.access;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+
+public class AuthorizationTest {
+
+ @Test
+ public void testDuplicateExpressions() {
+ // Test that we can de-duplicate a list of String expressions
+ Set<String> expected = Set.of("A&B", "A&C");
+ var authorization = Authorizations.of("A&B", "A&C", "A&B", "A&B", "A&C");
+ assertEquals(expected, authorization.asSet());
Review Comment:
Would be nice to check the other method has the same behavior for dupes. Think the following should do it.
```suggestion
assertEquals(expected, authorization.asSet());
authorization = Authorizations.of(List.of("A&B", "A&C", "A&B", "A&B", "A&C"));
assertEquals(expected, authorization.asSet());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fixes issue #66: adds a restriction info object that the UI can pull if it is present [accumulo-access]
Posted by "phrocker (via GitHub)" <gi...@apache.org>.
phrocker closed pull request #67: Fixes issue #66: adds a restriction info object that the UI can pull if it is present
URL: https://github.com/apache/accumulo-access/pull/67
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fixes FUZE-855: adds a restriction info object that the UI can pull if it is present [accumulo-access]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on PR #67:
URL: https://github.com/apache/accumulo-access/pull/67#issuecomment-1989236422
Created another possible solution in #68 that will either dedupe or throw an exception based on a new input parameter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fixes FUZE-855: adds a restriction info object that the UI can pull if it is present [accumulo-access]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on PR #67:
URL: https://github.com/apache/accumulo-access/pull/67#issuecomment-1982203166
I think we can just change the API so that the user must provide us with a deduplicated set of authorizations. Then we don't have to worry about it or throw an exception. My suggestion on the issue - https://github.com/apache/accumulo-access/issues/66#issuecomment-1979782116
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fixes FUZE-855: adds a restriction info object that the UI can pull if it is present [accumulo-access]
Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #67:
URL: https://github.com/apache/accumulo-access/pull/67#discussion_r1515069702
##########
src/test/java/org/apache/accumulo/access/AuthorizationTest.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.access;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+
+public class AuthorizationTest {
+
+ @Test
+ public void testDuplicateExpressions() {
+ // Test that we can de-duplicate a list of String expressions
+ Set<String> expected = Set.of("A&B", "A&C");
+ var authorization = Authorizations.of("A&B", "A&C", "A&B", "A&B", "A&C");
Review Comment:
These are very confusing examples of Authorizations, since they include a `&` which makes them look like an AccessExpression (visibility label) rather than a set of Authorizations, which typically don't contain such a character. In theory, authorizations could contain these, but they would need to be escaped.
Also, the name of the method says "testDuplicateExpressions", when you're really testing duplicate authorizations.
##########
src/main/java/org/apache/accumulo/access/Authorizations.java:
##########
@@ -64,7 +65,8 @@ public String toString() {
}
public static Authorizations of(String... authorizations) {
- return new Authorizations(Set.of(authorizations));
+ // Use Set.copyOf to remove duplicates if they exist
+ return new Authorizations(Set.copyOf(Arrays.asList(authorizations)));
Review Comment:
I think it would be better to keep the `Set.of()` so it issues an obvious error to the user if they supply duplicates, since duplicates could indicate a user typo or similar error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fixes issue #66: adds a restriction info object that the UI can pull if it is present [accumulo-access]
Posted by "phrocker (via GitHub)" <gi...@apache.org>.
phrocker commented on PR #67:
URL: https://github.com/apache/accumulo-access/pull/67#issuecomment-1989351307
> These changes look good and re the test location, I think creating the new test class makes sense.
>
> I don't understand the PR description.
Sorry about the description. Copy and pasta error. I'll close this out since @dlmarion submitting a good middle ground.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org