azotcsit commented on a change in pull request #1245:
URL: https://github.com/apache/cassandra/pull/1245#discussion_r721670094
##########
File path: test/unit/org/apache/cassandra/auth/AuthTestUtils.java
##########
@@ -18,7 +18,12 @@
package org.apache.cassandra.auth;
+import java.util.Map;
Review comment:
Are these imports required?
##########
File path: src/java/org/apache/cassandra/service/ClientState.java
##########
@@ -425,9 +427,22 @@ public void ensurePermission(Permission permission,
Function function)
private void ensurePermissionOnResourceChain(Permission perm, IResource
resource)
{
- for (IResource r : Resources.chain(resource))
- if (authorize(r).contains(perm))
- return;
+ if (DatabaseDescriptor.getAuthFromRoot())
Review comment:
Even though the current implementation looks good, I feel there is a
small point for improvement:
```
List<? extends IResource> resources = Resources.chain(resource);
if (DatabaseDescriptor.getAuthFromRoot())
resources = Lists.reverse(resources);
for (IResource r : resources)
if (authorize(r).contains(perm))
return;
```
As for me this version has a few minor advantages:
1. more compact
2. does not have cast operation (I generally consider them unsafe)
3. does not have duplicated "looping logic"
##########
File path: CHANGES.txt.orig
##########
@@ -0,0 +1,7203 @@
+4.1
Review comment:
This file is smth related to merge process, it needs to be deleted
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]