You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/10/18 09:58:05 UTC

[GitHub] [inlong] healchow commented on a diff in pull request #6206: [INLONG-5049][Manager] Command tools add CRUD for user

healchow commented on code in PR #6206:
URL: https://github.com/apache/inlong/pull/6206#discussion_r997989844


##########
inlong-manager/manager-client-tools/src/main/java/org/apache/inlong/manager/client/cli/UpdateCommand.java:
##########
@@ -160,4 +165,40 @@ void run() {
             }
         }
     }
+
+    @Parameters(commandDescription = "Update User")
+    private static class UpdateUser extends AbstractCommandRunner {
+
+        @Parameter()
+        private List<String> params;
+
+        @Parameter(names = {"-u", "--username"}, description = "username to be modify")
+        private String username;
+
+        @Parameter(names = {"-d", "--days"}, description = "new valid days")
+        private Integer validDays;
+
+        @Override
+        void run() {
+            try {
+                UserRequest request = new UserRequest();
+                request.setName(username);
+                ClientUtils.initClientFactory();
+                UserClient userClient = ClientUtils.clientFactory.getUserClient();
+                List<UserInfo> userInfo = userClient.list(request).getList();
+                if (userInfo == null) {
+                    throw new BusinessException(username + " not exist, please check.");
+                }
+                request.setId(userInfo.get(0).getId());
+                request.setAccountType(userInfo.get(0).getAccountType());

Review Comment:
   Suggest adding getByName API for users.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org