You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/10/11 20:34:55 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3012: Update ConfigCommand to check site and system permissions

ctubbsii commented on code in PR #3012:
URL: https://github.com/apache/accumulo/pull/3012#discussion_r992749223


##########
shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java:
##########
@@ -155,30 +156,56 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s
     } else {
       // display properties
       final TreeMap<String,String> systemConfig = new TreeMap<>();
-      systemConfig
-          .putAll(shellState.getAccumuloClient().instanceOperations().getSystemConfiguration());
+      final TreeMap<String,String> siteConfig = new TreeMap<>();
+      boolean canReadSystemSiteConfig = false;
+
+      try {
+        // The user may not have permissions for system/site configs so handle security exception by
+        // wrapping
+        // in a try/catch block and setting a flag
+        systemConfig
+            .putAll(shellState.getAccumuloClient().instanceOperations().getSystemConfiguration());
+        siteConfig
+            .putAll(shellState.getAccumuloClient().instanceOperations().getSiteConfiguration());
+        canReadSystemSiteConfig = true;
+      } catch (AccumuloException | AccumuloSecurityException e) {
+        if (isSecurityException(e) && (tableName != null || namespace != null)) {
+          Shell.log.debug(
+              "User does not have permission to read system and/or site configuration: {}",
+              e.getMessage());

Review Comment:
   I would put this as a warning rather than debug. This could also be separate messages, with information about what shell command to use to grant the appropriate permission.



-- 
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