You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/08/23 14:19:57 UTC

[GitHub] [incubator-seatunnel] luketalent opened a new pull request, #2510: [seatunnel-1947][seatunnel-server] add auth for server

luketalent opened a new pull request, #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   add auth for server
   ## Check list
   
   * [X] Code changed are covered with tests, or it does not need tests for reason:
   * [X] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


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

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


[GitHub] [incubator-seatunnel] luketalent commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
luketalent commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r953464828


##########
seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/RoleMapper.xml:
##########
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.seatunnel.app.dal.mapper.RoleMapper">
+  <resultMap id="BaseResultMap" type="org.apache.seatunnel.app.dal.entity.Role">
+    <!-...@mbg.generated-->
+    <!--@Table `role`-->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="desc" jdbcType="VARCHAR" property="desc" />

Review Comment:
   I will fix it



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

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


[GitHub] [incubator-seatunnel] dijiekstra commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
dijiekstra commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r956718137


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/controller/AuthController.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.seatunnel.app.controller;
+
+import org.apache.seatunnel.app.common.Result;
+import org.apache.seatunnel.app.service.IRoleService;
+
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.NotNull;
+
+@RequestMapping("/api/v1/auth")
+@RestController
+public class AuthController {
+
+    @Resource
+    private IRoleService roleServiceImpl;
+
+    @GetMapping("/userRole")
+    @ApiOperation(value = "check relation between user and role", httpMethod = "GET")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userName", value = "user name", dataType = "String"),

Review Comment:
   make `userName` lowercase



##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/RoleServiceImpl.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.seatunnel.app.service.impl;
+
+import static org.apache.seatunnel.server.common.SeatunnelErrorEnum.NO_SUCH_USER;
+import static com.google.common.base.Preconditions.checkState;
+
+import org.apache.seatunnel.app.common.RoleTypeEnum;
+import org.apache.seatunnel.app.common.UserTypeEnum;
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.dao.IRoleUserRelationDao;
+import org.apache.seatunnel.app.dal.dao.IUserDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.entity.RoleUserRelation;
+import org.apache.seatunnel.app.dal.entity.User;
+import org.apache.seatunnel.app.service.IRoleService;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+import java.util.Objects;
+
+@Service
+@Slf4j
+public class RoleServiceImpl implements IRoleService {
+
+    @Resource
+    private IRoleDao roleDaoImpl;
+
+    @Resource
+    private IRoleUserRelationDao roleUserRelationDaoImpl;
+
+    @Resource
+    private IUserDao userDaoImpl;
+
+    @Override
+    public boolean addUserToRole(Integer userId, Integer type){
+
+        String roleName = type == UserTypeEnum.ADMIN.getCode() ? RoleTypeEnum.ADMIN.getDescription() : RoleTypeEnum.NORMAL.getDescription();

Review Comment:
   add parse(int code) to enum instead of ternary expression



##########
seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/RoleMapper.xml:
##########
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.seatunnel.app.dal.mapper.RoleMapper">
+  <resultMap id="BaseResultMap" type="org.apache.seatunnel.app.dal.entity.Role">
+    <!-...@mbg.generated-->

Review Comment:
   remove useless comment



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

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


[GitHub] [incubator-seatunnel] zhuangchong commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
zhuangchong commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955559036


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   > This is a very common practice in the industry. When we have multiple mapper combinations, it can all be done at the dao layer, and the cache can also be done at the dao layer.
   
   When we have multiple mapper combinations, we do it more at the service layer, and the combination will involve business logic.



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

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


[GitHub] [incubator-seatunnel] luketalent commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
luketalent commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r953459501


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/entity/RoleUserRelation.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.seatunnel.app.dal.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class RoleUserRelation {
+
+    private Integer id;
+
+    private Integer roleId;
+
+    private Integer userId;
+
+    private Date createTime;
+
+    private Date updateTime;

Review Comment:
   I will modify the mapper.xml 



##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/RoleServiceImpl.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.seatunnel.app.service.impl;
+
+import static org.apache.seatunnel.server.common.SeatunnelErrorEnum.NO_SUCH_USER;
+import static com.google.common.base.Preconditions.checkState;
+
+import org.apache.seatunnel.app.common.RoleTypeEnum;
+import org.apache.seatunnel.app.common.UserTypeEnum;
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.dao.IRoleUserRelationDao;
+import org.apache.seatunnel.app.dal.dao.IUserDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.entity.RoleUserRelation;
+import org.apache.seatunnel.app.dal.entity.User;
+import org.apache.seatunnel.app.service.IRoleService;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import java.util.Objects;
+
+@Service
+@Slf4j
+public class RoleServiceImpl implements IRoleService {
+
+    @Resource
+    private IRoleDao roleDaoImpl;
+
+    @Resource
+    private IRoleUserRelationDao roleUserRelationDaoImpl;
+
+    @Resource
+    private IUserDao userDaoImpl;
+
+    @PostConstruct
+    public void roleInit() {
+
+        final Role adminRole = Role.builder()
+                .name(RoleTypeEnum.ADMIN.getDescription())
+                .type(RoleTypeEnum.ADMIN.getCode())
+                .build();

Review Comment:
   OK,I will delete this part



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

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


[GitHub] [incubator-seatunnel] CalvinKirs merged pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs merged PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510


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

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955574087


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   > Haven't considered using SpringDataJPA? I understand that SpringDataJPA is more suitable for back-end management systems.
   
   TBH, personally I prefer to control the SQL myself, I understand we should have some complex queries.



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

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r952728259


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/RoleServiceImpl.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.seatunnel.app.service.impl;
+
+import static org.apache.seatunnel.server.common.SeatunnelErrorEnum.NO_SUCH_USER;
+import static com.google.common.base.Preconditions.checkState;
+
+import org.apache.seatunnel.app.common.RoleTypeEnum;
+import org.apache.seatunnel.app.common.UserTypeEnum;
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.dao.IRoleUserRelationDao;
+import org.apache.seatunnel.app.dal.dao.IUserDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.entity.RoleUserRelation;
+import org.apache.seatunnel.app.dal.entity.User;
+import org.apache.seatunnel.app.service.IRoleService;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import java.util.Objects;
+
+@Service
+@Slf4j
+public class RoleServiceImpl implements IRoleService {
+
+    @Resource
+    private IRoleDao roleDaoImpl;
+
+    @Resource
+    private IRoleUserRelationDao roleUserRelationDaoImpl;
+
+    @Resource
+    private IUserDao userDaoImpl;
+
+    @PostConstruct
+    public void roleInit() {
+
+        final Role adminRole = Role.builder()
+                .name(RoleTypeEnum.ADMIN.getDescription())
+                .type(RoleTypeEnum.ADMIN.getCode())
+                .build();

Review Comment:
   I would prefer to put such an operation in the initialization script, not in the program



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

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r952731605


##########
seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/RoleMapper.xml:
##########
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.seatunnel.app.dal.mapper.RoleMapper">
+  <resultMap id="BaseResultMap" type="org.apache.seatunnel.app.dal.entity.Role">
+    <!-...@mbg.generated-->
+    <!--@Table `role`-->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="type" jdbcType="INTEGER" property="type" />

Review Comment:
   How many roles will we have and do we need an int?



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

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955589341


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   +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@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955573761


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   Usually the dao layer is only the access interface corresponding to sql, and the business logic will not be involved 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: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] luketalent commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
luketalent commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r953458078


##########
seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/RoleMapper.xml:
##########
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.seatunnel.app.dal.mapper.RoleMapper">
+  <resultMap id="BaseResultMap" type="org.apache.seatunnel.app.dal.entity.Role">
+    <!-...@mbg.generated-->
+    <!--@Table `role`-->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="type" jdbcType="INTEGER" property="type" />

Review Comment:
   It is necessary to use the int type for role type:
   1. If we control all elements of the page,we have multiple types of permissions and roles
   2. In order to facilitate subsequent expansion, custom roles can be supported later



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

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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r954439253


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   @CalvinKirs  Do you have any opinion?



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

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r952730329


##########
seatunnel-server/seatunnel-app/src/main/resources/org/apache/seatunnel/app/dal/mapper/RoleMapper.xml:
##########
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.seatunnel.app.dal.mapper.RoleMapper">
+  <resultMap id="BaseResultMap" type="org.apache.seatunnel.app.dal.entity.Role">
+    <!-...@mbg.generated-->
+    <!--@Table `role`-->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="desc" jdbcType="VARCHAR" property="desc" />

Review Comment:
   Avoid using database keywords as field names



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

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


[GitHub] [incubator-seatunnel] dijiekstra commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
dijiekstra commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955584850


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   > > This is a very common practice in the industry. When we have multiple mapper combinations, it can all be done at the dao layer, and the cache can also be done at the dao layer.
   > 
   > When we have multiple mapper combinations, we do it more at the service layer, and the combination will involve business logic.
   
   If we want to canche some data, do it at `service` is not suitable, so we need `dao` to be the buffer



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

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955590147


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   For business systems, join is a very bad practice.



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

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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r954438465


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   Is **Mapper different from **Dao? Are the methods completely duplicated?



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

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


[GitHub] [incubator-seatunnel] luketalent commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
luketalent commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955588728


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   > Usually the dao layer is only the access interface corresponding to sql, and the business logic will not be involved here.
   
   For the same type of mapper, the dao layer can perform unified transparent transmission. For example, that is, a dao can correspond to multiple mappers, and a combined query can be done at the dao layer instead of using join.



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

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


[GitHub] [incubator-seatunnel] luketalent commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
luketalent commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955588638


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   > Usually the dao layer is only the access interface corresponding to sql, and the business logic will not be involved here.
   
   I agree



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

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


[GitHub] [incubator-seatunnel] luketalent commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
luketalent commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r954573383


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   This is a very common practice in the industry. When we have multiple mapper combinations, it can all be done at the dao layer, and the cache can also be done at the dao layer.
   
   



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

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


[GitHub] [incubator-seatunnel] zhuangchong commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
zhuangchong commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955553823


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   Haven't considered using SpringDataJPA? I understand that SpringDataJPA is more suitable for back-end management systems.



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

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


[GitHub] [incubator-seatunnel] luketalent commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
luketalent commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r955588314


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/dao/impl/RoleDaoImpl.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.app.dal.dao.impl;
+
+import org.apache.seatunnel.app.dal.dao.IRoleDao;
+import org.apache.seatunnel.app.dal.entity.Role;
+import org.apache.seatunnel.app.dal.mapper.RoleMapper;
+
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+
+@Repository
+public class RoleDaoImpl implements IRoleDao {
+
+    @Resource
+    private RoleMapper roleMapper;
+
+    @Override
+    public void add(Role role){
+        roleMapper.insert(role);
+    }
+
+    @Override
+    public Role getByRoleName(String roleName) {
+        return roleMapper.selectByRole(roleName);
+    }
+
+}

Review Comment:
   > 
   For the same type of mapper, the dao layer can perform unified transparent transmission. For example, that is, a dao can correspond to multiple mappers, and a combined query can be done at the dao layer instead of using join. 
   



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

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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2510: [seatunnel-1947][seatunnel-server] add auth for server

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2510:
URL: https://github.com/apache/incubator-seatunnel/pull/2510#discussion_r952721981


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/dal/entity/RoleUserRelation.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.seatunnel.app.dal.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class RoleUserRelation {
+
+    private Integer id;
+
+    private Integer roleId;
+
+    private Integer userId;
+
+    private Date createTime;
+
+    private Date updateTime;

Review Comment:
   @dijiekstra Hi, could we unify the time storage format, in addition, can the basic fields of create_time update - time be done automatically without showing updates or additions



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

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