smengcl commented on a change in pull request #696: HDDS-3056. Allow users to 
list volumes they have access to, and optionally allow all users to list all 
volumes
URL: https://github.com/apache/hadoop-ozone/pull/696#discussion_r401245510
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
 ##########
 @@ -1819,7 +1823,30 @@ public void deleteVolume(String volume) throws 
IOException {
     auditMap.put(OzoneConsts.USERNAME, userName);
     try {
       metrics.incNumVolumeLists();
-      return volumeManager.listVolumes(userName, prefix, prevKey, maxKeys);
+      if (isAclEnabled) {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("ACL is enabled. Listing volumes accessible by user. "
+                  + "Principal: {}, keytab: {}",
+              configuration.get(OZONE_OM_KERBEROS_PRINCIPAL_KEY),
+              configuration.get(OZONE_OM_KERBEROS_KEYTAB_FILE_KEY));
+        }
+        // List all volumes first
+        List<OmVolumeArgs> listOfAllVolumes = volumeManager.listVolumes(
+            null, prefix, prevKey, maxKeys);
+        // Filter all volumes by ACL LIST permission of UGI
+        return listOfAllVolumes.stream().filter(v -> v.getAclMap()
+            .hasAccess(IAccessAuthorizer.ACLType.LIST, remoteUserUgi))
+            .collect(Collectors.toList());
+      } else {
+        if (LOG.isDebugEnabled()) {
 
 Review comment:
   Remove log

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to