You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/06/10 18:53:00 UTC

[GitHub] [ozone] smengcl commented on a diff in pull request #3503: HDDS-6870 Clean up isTenantAdmin to use UGI

smengcl commented on code in PR #3503:
URL: https://github.com/apache/ozone/pull/3503#discussion_r894812764


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/upgrade/OMFinalizeUpgradeRequest.java:
##########
@@ -66,10 +66,11 @@ public OMClientResponse validateAndUpdateCache(
     OMClientResponse response = null;
 
     try {
-      String username = getOmRequest().getUserInfo().getUserName();
-      if (ozoneManager.getAclsEnabled() && !ozoneManager.isAdmin(username)) {
-        throw new OMException("Access denied for user " + username + ". " +
-            "Superuser privilege is required to finalize upgrade.",
+      if (ozoneManager.getAclsEnabled()
+          && !ozoneManager.isAdmin(createUGI())) {
+        throw new OMException("Access denied for user "
+            + createUGI() + ". "
+            + "Superuser privilege is required to finalize upgrade.",
             OMException.ResultCodes.ACCESS_DENIED);
       }

Review Comment:
   ```suggestion
         if (ozoneManager.getAclsEnabled()) {
           final UserGroupInformation ugi = createUGI();
           if (!ozoneManager.isAdmin(ugi)) {
             throw new OMException("Access denied for user " + ugi + ". "
                 + "Superuser privilege is required to finalize upgrade.",
                 OMException.ResultCodes.ACCESS_DENIED);
           }
         }
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org