justinmclean commented on code in PR #6170:
URL: https://github.com/apache/gravitino/pull/6170#discussion_r1909448335
##########
clients/cli/src/main/java/org/apache/gravitino/cli/RoleCommandHandler.java:
##########
@@ -0,0 +1,142 @@
+package org.apache.gravitino.cli;
+
+import com.google.common.base.Preconditions;
+import java.util.Arrays;
+import org.apache.commons.cli.CommandLine;
+import org.apache.gravitino.cli.commands.Command;
+
+public class RoleCommandHandler extends CommandHandler {
+
+ private final GravitinoCommandLine gravitinoCommandLine;
+ private final CommandLine line;
+ private final String command;
+ private final boolean ignore;
+ private final String url;
+ private String metalake;
+
+ public RoleCommandHandler(
+ GravitinoCommandLine gravitinoCommandLine, CommandLine line, String
command, boolean ignore) {
+ this.gravitinoCommandLine = gravitinoCommandLine;
+ this.line = line;
+ this.command = command;
+ this.ignore = ignore;
+ this.url = getUrl(line);
+ }
+
+ /** Handles the command execution logic based on the provided command. */
+ public void handle() {
+ String auth = getAuth(line);
+ String userName = line.getOptionValue(GravitinoOptions.LOGIN);
+ Command.setAuthenticationMode(auth, userName);
+
+ metalake = new FullName(line).getMetalakeName();
+
+ String[] roles = line.getOptionValues(GravitinoOptions.ROLE);
+ if (roles == null && !CommandActions.LIST.equals(command)) {
+ System.err.println(ErrorMessages.MISSING_ROLE);
+ Main.exit(-1);
+ }
+ if (roles != null) {
+ roles = Arrays.stream(roles).distinct().toArray(String[]::new);
+ }
+
+ String[] privileges = line.getOptionValues(GravitinoOptions.PRIVILEGE);
Review Comment:
same here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]