HBASE-11251-LoadTestTool should grant READ permission for the users that
are given READ access for specific cells (Ram)
This commit is contained in:
parent
de1f96096a
commit
1ce333901e
|
@ -517,19 +517,38 @@ public class LoadTestTool extends AbstractHBaseTool {
|
||||||
if (userOwner != null) {
|
if (userOwner != null) {
|
||||||
LOG.info("Granting permission for the user " + userOwner.getShortName());
|
LOG.info("Granting permission for the user " + userOwner.getShortName());
|
||||||
AccessControlProtos.Permission.Action[] actions = {
|
AccessControlProtos.Permission.Action[] actions = {
|
||||||
AccessControlProtos.Permission.Action.ADMIN,
|
AccessControlProtos.Permission.Action.ADMIN, AccessControlProtos.Permission.Action.CREATE,
|
||||||
AccessControlProtos.Permission.Action.CREATE, AccessControlProtos.Permission.Action.READ,
|
AccessControlProtos.Permission.Action.READ, AccessControlProtos.Permission.Action.WRITE };
|
||||||
AccessControlProtos.Permission.Action.WRITE };
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AccessControlClient.grant(conf, tableName, userOwner.getShortName(), COLUMN_FAMILY,
|
AccessControlClient.grant(conf, tableName, userOwner.getShortName(), null, null, actions);
|
||||||
null, actions);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LOG.fatal("Error in granting permission for the user " + userOwner.getShortName(), e);
|
LOG.fatal("Error in granting permission for the user " + userOwner.getShortName(), e);
|
||||||
return EXIT_FAILURE;
|
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 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 permission for the user " + user.getShortName(), e);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isWrite) {
|
if (isWrite) {
|
||||||
if (userOwner != null) {
|
if (userOwner != null) {
|
||||||
writerThreads = new MultiThreadedWriterWithACL(dataGen, conf, tableName, userOwner);
|
writerThreads = new MultiThreadedWriterWithACL(dataGen, conf, tableName, userOwner);
|
||||||
|
|
Loading…
Reference in New Issue