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/04/20 05:12:18 UTC

[GitHub] [incubator-inlong] herywang commented on a diff in pull request #3847: [INLONG-3673][Manager] Support URL permission access control according to user role

herywang commented on code in PR #3847:
URL: https://github.com/apache/incubator-inlong/pull/3847#discussion_r853731510


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/UserRoleCode.java:
##########
@@ -0,0 +1,23 @@
+/*
+ * 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.inlong.manager.common.pojo.user;
+
+public class UserRoleCode {
+    public static final String ADMIN = "MANAGER";

Review Comment:
   Because the enumeration type used in the original code is `MANAGER`: 
   ```java
   /**
    * User type enum
    */
   public enum UserTypeEnum {
   
       MANAGER(0), // has all privilege
       OPERATOR(1), // No privilege to manage the system
       ;
   
       @Getter
       @JsonValue
       private final Integer code;
   
       UserTypeEnum(Integer code) {
           this.code = code;
       }
   
       public static UserTypeEnum parse(Integer value) {
           return Arrays.stream(UserTypeEnum.class.getEnumConstants())
                   .filter(x -> x.getCode().equals(value))
                   .findAny()
                   .orElse(null);
       }
   }
   ```
   
   Actually, I think we can change the enum code of `UserTypeEnum.java`:  
   `MANAGER(0) -> Admin(0)`. 
   `OPERATOR(1) -> Operator(1)`



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