starocean999 commented on code in PR #47554:
URL: https://github.com/apache/doris/pull/47554#discussion_r2036680296


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateUserInfo.java:
##########
@@ -0,0 +1,162 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.plans.commands.info;
+
+import org.apache.doris.analysis.PassVar;
+import org.apache.doris.analysis.PasswordOptions;
+import org.apache.doris.analysis.UserDesc;
+import org.apache.doris.analysis.UserIdentity;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.cluster.ClusterNamespace;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.Config;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.FeNameFormat;
+import org.apache.doris.mysql.authenticate.AuthenticateType;
+import org.apache.doris.mysql.privilege.PrivPredicate;
+import org.apache.doris.mysql.privilege.Role;
+import org.apache.doris.qe.ConnectContext;
+
+import com.google.common.base.Strings;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.UUID;
+
+/**
+ * CreateUserInfo
+ */
+public class CreateUserInfo {
+    private static final Logger LOG = 
LogManager.getLogger(CreateUserInfo.class);
+    private boolean ifNotExist;
+    private String role;
+    private PasswordOptions passwordOptions;
+    private String comment;
+    private UserIdentity userIdent;
+    private PassVar passVar;
+    private String userId;
+
+    /**
+     * CreateUserInfo
+     */
+    public CreateUserInfo(boolean ifNotExist, UserDesc userDesc,
+            String role, PasswordOptions passwordOptions, String comment) {
+        this.ifNotExist = ifNotExist;
+        this.userIdent = userDesc.getUserIdent();
+        this.passVar = userDesc.getPassVar();
+        this.role = role;
+        this.passwordOptions = passwordOptions;
+        this.comment = comment;
+
+        String uId = Env.getCurrentEnv().getAuth().getUserId(ClusterNamespace
+                .getNameFromFullName(this.userIdent.getUser()));
+        LOG.debug("create user stmt userIdent {}, userName {}, userId {}",
+                this.userIdent, 
ClusterNamespace.getNameFromFullName(this.userIdent.getUser()), uId);
+        // avoid this case "jack@'192.1'" and "jack@'192.2'", jack's uid 
different
+        if (Strings.isNullOrEmpty(uId)) {
+            userId = UUID.randomUUID().toString();
+        } else {
+            userId = uId;
+        }
+    }
+
+    /**
+     * CreateUserInfo
+     */
+    public CreateUserInfo(UserDesc userDesc) {

Review Comment:
   ```suggestion
       public CreateUserInfo(UserDesc userDesc) {
       this(false, userDesc, ....)
   ```
   delegate to another constructor to keep simplicity



-- 
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-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to