dlmarion commented on code in PR #3109:
URL: https://github.com/apache/accumulo/pull/3109#discussion_r1049792546
##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader9to10.java:
##########
@@ -143,43 +141,58 @@ public void upgradeZookeeper(ServerContext context) {
createScanServerNodes(context);
}
+ private static String extractAuthName(ACL acl) {
+ Objects.requireNonNull(acl, "provided ACL cannot be null");
+ try {
+ return acl.getId().getId().trim().split(":")[0];
+ } catch (Exception ex) {
+ log.debug("Invalid ACL passed, cannot parse id from '{}'", acl);
+ return "";
+ }
+ }
+
+ private static boolean canWrite(List<ACL> acls) {
+ if (ZooDefs.Ids.OPEN_ACL_UNSAFE.equals(acls)) {
+ return true;
+ }
+ ;
+ for (ACL acl : acls) {
+ String name = extractAuthName(acl);
+ if (("accumulo".equals(name) || "anyone".equals(name))
+ && acl.getPerms() >= ZooDefs.Perms.WRITE) {
+ return true;
+ }
+ }
+ return false;
Review Comment:
Addressed in def13d1. `findAny` didn't compile, used `anyMatch` instead.
--
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]