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 2021/12/05 10:23:53 UTC

[GitHub] [dolphinscheduler] zhongjiajie commented on a change in pull request #7189: Fix homepage user statistics result missing filter by user

zhongjiajie commented on a change in pull request #7189:
URL: https://github.com/apache/dolphinscheduler/pull/7189#discussion_r762540820



##########
File path: dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/User.java
##########
@@ -221,6 +221,20 @@ public void setState(int state) {
         this.state = state;
     }
 
+    /**
+     * Get user statistics information id.
+     *
+     * This id decide what statistics information the user can see, if user is admin,
+     * it could see all statistics information, so we return `null` to unlimited statistics
+     * scope, but if user is general user, it could only see himself statistics information
+     * filtering data by user id.
+     *
+     * @return user Integer
+     */
+    public Integer getUserStatId() {
+        return this.userType == UserType.ADMIN_USER ? null : this.id;
+    }
+

Review comment:
       For reviewers, I add attribute `getUserStatId` and add desc about it, to reduce deplicate code in service.




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