You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/04/24 07:34:34 UTC

[GitHub] [dolphinscheduler] litiliu commented on a diff in pull request #9536: bugfix:relation_project_user duplicate

litiliu commented on code in PR #9536:
URL: https://github.com/apache/dolphinscheduler/pull/9536#discussion_r857080449


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java:
##########
@@ -609,15 +605,18 @@ public Map<String, Object> grantProjectByCode(final User loginUser, final int us
             return result;
         }
 
-        // 4. maintain the relationship between project and user
-        final Date today = new Date();
-        ProjectUser projectUser = new ProjectUser();
-        projectUser.setUserId(userId);
-        projectUser.setProjectId(project.getId());
-        projectUser.setPerm(7);
-        projectUser.setCreateTime(today);
-        projectUser.setUpdateTime(today);
-        this.projectUserMapper.insert(projectUser);
+        // 4. maintain the relationship between project and user if not exists
+        ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), userId);
+        if (projectUser == null) {
+            final Date today = new Date();

Review Comment:
   Maybe the final identifier is not needed?



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

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