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 07:38:55 UTC

[GitHub] [inlong] haifxu opened a new pull request, #6206: [INLONG-5049][Manager] Command tools add CRUD for user

haifxu opened a new pull request, #6206:
URL: https://github.com/apache/inlong/pull/6206

   ### Prepare a Pull Request
   
   - Fixes #5049 
   
   ### Motivation
   
   Command tools add CRUD for user.
   
   ### Modifications
   
   1. Support get `UserTypeEnum.code` by `UserTypeEnum.name` in `UserTypeEnum`
   2. Add CRUD for user.
   
   ### Verifying this change
   
   1.managerctl list user
   ```
   user      Get user summary information
         Usage: user [options]
           Options:
             --type
               user type
             -u, --username
               username
   ```
   
   2.managerctl describe user
   ```
   user      Get user details
         Usage: user [options]
           Options:
           * -id, --id
               user id
   ```
   3.managerctl create user
   ```
   user      Create user
         Usage: user [options]
           Options:
             -d, --days
               valid days
             -p, --password
               password
             -t, --type
               account type
             -u, --username
               username
   ```
   4.managerctl update user
   ```
   user      Update User
         Usage: user [options]
           Options:
             -d, --days
               new valid days
             -u, --username
               username to be modify
   ```
   5.managerctl delete user
   ```
   user      Delete user by user id
         Usage: user [options]
           Options:
           * -id, --id
               user id
   ```
   


-- 
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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
haifxu commented on code in PR #6206:
URL: https://github.com/apache/inlong/pull/6206#discussion_r998081416


##########
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:
   Done.



-- 
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


[GitHub] [inlong] dockerzhang merged pull request #6206: [INLONG-5049][Manager] Command tools add CRUD for user

Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #6206:
URL: https://github.com/apache/inlong/pull/6206


-- 
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