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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to