hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject git commit: HBASE-11251-LoadTestTool should grant READ permission for the users that are given READ access for specific cells (Ram)
Date Mon, 26 May 2014 06:16:41 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 503709fdf -> 6c46a07f1


HBASE-11251-LoadTestTool should grant READ permission for the users that
are given READ access for specific cells (Ram)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6c46a07f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6c46a07f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6c46a07f

Branch: refs/heads/0.98
Commit: 6c46a07f16bf399757f1e0152ddf58aadb6345a2
Parents: 503709f
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Mon May 26 11:44:44 2014 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Mon May 26 11:44:44 2014 +0530

----------------------------------------------------------------------
 .../apache/hadoop/hbase/util/LoadTestTool.java  | 30 +++++++++++++++-----
 1 file changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6c46a07f/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
index a43af55..a156fa2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
@@ -42,7 +42,6 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.PerformanceEvaluation;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.io.compress.Compression;
 import org.apache.hadoop.hbase.io.crypto.Cipher;
 import org.apache.hadoop.hbase.io.crypto.Encryption;
@@ -517,20 +516,37 @@ public class LoadTestTool extends AbstractHBaseTool {
 
     if (userOwner != null) {
       LOG.info("Granting permission for the user " + userOwner.getShortName());
-      HTable table = new HTable(conf, tableName);
       AccessControlProtos.Permission.Action[] actions = {
-          AccessControlProtos.Permission.Action.ADMIN,
-          AccessControlProtos.Permission.Action.CREATE, AccessControlProtos.Permission.Action.READ,
-          AccessControlProtos.Permission.Action.WRITE };
+        AccessControlProtos.Permission.Action.ADMIN, AccessControlProtos.Permission.Action.CREATE,
+        AccessControlProtos.Permission.Action.READ, AccessControlProtos.Permission.Action.WRITE
};
 
       try {
-        AccessControlClient.grant(conf, table.getName(), userOwner.getShortName(), COLUMN_FAMILY,
-            null, actions);
+        AccessControlClient.grant(conf, tableName, userOwner.getShortName(), null, null,
actions);
       } catch (Throwable e) {
         LOG.fatal("Error in granting permission for the user " + userOwner.getShortName(),
e);
         return EXIT_FAILURE;
       }
     }
+    if (userNames != null) {
+      // This will be comma separated list of expressions.
+      String users[] = userNames.split(",");
+      User user = null;
+      for (String userStr : users) {
+        if (isSecure(conf)) {
+          user = User.create(loginAndReturnUGI(conf, userStr));
+        } else {
+          user = User.createUserForTesting(conf, userStr, new String[0]);
+        }
+        LOG.info("Granting READ permission for the user " + user.getShortName());
+        AccessControlProtos.Permission.Action[] actions = { AccessControlProtos.Permission.Action.READ
};
+        try {
+          AccessControlClient.grant(conf, tableName, user.getShortName(), null, null, actions);
+        } catch (Throwable e) {
+          LOG.fatal("Error in granting READ permission for the user " + user.getShortName(),
e);
+          return EXIT_FAILURE;
+        }
+      }
+    }
 
     if (isWrite) {
       if (userOwner != null) {


Mime
View raw message