HBASE-24345 [ACL] renameRSGroup should require Admin level permission (#1683)
Signed-off-by: binlijin <binlijin@gmail.com> Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
03e5a1402d
commit
0cd70ed89c
|
@ -2685,4 +2685,10 @@ public class AccessController implements MasterCoprocessor, RegionCoprocessor,
|
|||
null, Permission.Action.ADMIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenameRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String oldName,
|
||||
String newName) throws IOException {
|
||||
accessChecker.requirePermission(getActiveUser(ctx), "renameRSGroup",
|
||||
null, Permission.Action.ADMIN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,6 +331,8 @@ public abstract class TestRSGroupsBase {
|
|||
boolean postListTablesInRSGroupCalled = false;
|
||||
boolean preGetConfiguredNamespacesAndTablesInRSGroupCalled = false;
|
||||
boolean postGetConfiguredNamespacesAndTablesInRSGroupCalled = false;
|
||||
boolean preRenameRSGroup = false;
|
||||
boolean postRenameRSGroup = false;
|
||||
|
||||
public void resetFlags() {
|
||||
preBalanceRSGroupCalled = false;
|
||||
|
@ -361,6 +363,8 @@ public abstract class TestRSGroupsBase {
|
|||
postListTablesInRSGroupCalled = false;
|
||||
preGetConfiguredNamespacesAndTablesInRSGroupCalled = false;
|
||||
postGetConfiguredNamespacesAndTablesInRSGroupCalled = false;
|
||||
preRenameRSGroup = false;
|
||||
postRenameRSGroup = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -523,5 +527,17 @@ public abstract class TestRSGroupsBase {
|
|||
ObserverContext<MasterCoprocessorEnvironment> ctx, String groupName) throws IOException {
|
||||
postGetConfiguredNamespacesAndTablesInRSGroupCalled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenameRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String oldName,
|
||||
String newName) throws IOException {
|
||||
preRenameRSGroup = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRenameRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String oldName,
|
||||
String newName) throws IOException {
|
||||
postRenameRSGroup = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,6 +319,16 @@ public class TestRSGroupsWithACL extends SecureTestUtil {
|
|||
validateAdminPermissions(action);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenameRSGroup() throws Exception {
|
||||
AccessTestAction action = () -> {
|
||||
checkPermission("renameRSGroup");
|
||||
return null;
|
||||
};
|
||||
|
||||
validateAdminPermissions(action);
|
||||
}
|
||||
|
||||
private void validateAdminPermissions(AccessTestAction action) throws Exception {
|
||||
verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_GROUP_ADMIN);
|
||||
verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ,
|
||||
|
|
Loading…
Reference in New Issue