accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] milleruntime commented on a change in pull request #9: ACCUMULO-4717 Refactor WalkingSecurity to use API
Date Thu, 01 Jan 1970 00:00:00 GMT
milleruntime commented on a change in pull request #9: ACCUMULO-4717 Refactor WalkingSecurity
to use API
URL: https://github.com/apache/accumulo-testing/pull/9#discussion_r146957983
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/testing/core/randomwalk/security/AlterTable.java
 ##########
 @@ -34,13 +35,26 @@
 
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
-    Connector conn = env.getAccumuloInstance().getConnector(WalkingSecurity.get(state, env).getSysUserName(),
WalkingSecurity.get(state, env).getSysToken());
+    String systemUser = WalkingSecurity.get(state, env).getSysUserName();
+    Connector conn = env.getAccumuloInstance().getConnector(systemUser, WalkingSecurity.get(state,
env).getSysToken());
 
     String tableName = WalkingSecurity.get(state, env).getTableName();
 
     boolean exists = WalkingSecurity.get(state, env).getTableExists();
-    boolean hasPermission = conn.securityOperations().hasTablePermission(WalkingSecurity.get(state,
env).getSysUserName(), tableName,
-        TablePermission.ALTER_TABLE);
+    boolean hasPermission;
+    try {
+      hasPermission = conn.securityOperations().hasTablePermission(systemUser, tableName,
TablePermission.ALTER_TABLE)
+          || conn.securityOperations().hasSystemPermission(systemUser, SystemPermission.ALTER_TABLE);
+    } catch (AccumuloSecurityException ae) {
+      if (ae.getSecurityErrorCode().equals(SecurityErrorCode.TABLE_DOESNT_EXIST)) {
+        if (exists)
+          throw new TableExistsException(null, tableName, "Got a TableNotFoundException but
it should exist", ae);
 
 Review comment:
   Because I copied what was used below.  Think they should all just be AccumuloException?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message