Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2616,4 +2616,11 @@ public void preRenameRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx,
accessChecker.requirePermission(getActiveUser(ctx), "renameRSGroup",
null, Permission.Action.ADMIN);
}

@Override
public void preUpdateRSGroupConfig(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String groupName, final Map<String, String> configuration) throws IOException {
accessChecker
.requirePermission(getActiveUser(ctx), "updateRSGroupConfig", null, Permission.Action.ADMIN);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ public static class CPMasterObserver implements MasterCoprocessor, MasterObserve
boolean postGetConfiguredNamespacesAndTablesInRSGroupCalled = false;
boolean preRenameRSGroup = false;
boolean postRenameRSGroup = false;
boolean preUpdateRSGroupConfig = false;
boolean postUpdateRSGroupConfig = false;

public void resetFlags() {
preBalanceRSGroupCalled = false;
Expand Down Expand Up @@ -372,6 +374,8 @@ public void resetFlags() {
postGetConfiguredNamespacesAndTablesInRSGroupCalled = false;
preRenameRSGroup = false;
postRenameRSGroup = false;
preUpdateRSGroupConfig = false;
postUpdateRSGroupConfig = false;
}

@Override
Expand Down Expand Up @@ -546,5 +550,17 @@ public void postRenameRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx,
String newName) throws IOException {
postRenameRSGroup = true;
}

@Override
public void preUpdateRSGroupConfig(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String groupName, final Map<String, String> configuration) throws IOException {
preUpdateRSGroupConfig = true;
}

@Override
public void postUpdateRSGroupConfig(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String groupName, final Map<String, String> configuration) throws IOException {
postUpdateRSGroupConfig = true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,16 @@ public void testRenameRSGroup() throws Exception {
validateAdminPermissions(action);
}

@Test
public void testUpdateRSGroupConfig() throws Exception {
AccessTestAction action = () -> {
checkPermission("updateRSGroupConfig");
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,
Expand Down