fuweng11 commented on code in PR #8109:
URL: https://github.com/apache/inlong/pull/8109#discussion_r1209349797
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/WorkflowApproverServiceImpl.java:
##########
@@ -89,11 +92,18 @@ public Integer save(ApproverRequest request, String
operator) {
@Override
public ApproverResponse get(Integer id) {
Preconditions.expectNotNull(id, "approver id cannot be null");
+
WorkflowApproverEntity approverEntity = approverMapper.selectById(id);
if (approverEntity == null) {
LOGGER.error("workflow approver not found by id={}", id);
throw new
BusinessException(ErrorCodeEnum.WORKFLOW_APPROVER_NOT_FOUND);
}
+
+ UserInfo userInfo = LoginUserUtils.getLoginUser();
+ boolean isAdmin =
userInfo.getRoles().contains(UserTypeEnum.ADMIN.name());
+ Preconditions.expectTrue(isAdmin ||
approverEntity.getApprovers().contains(userInfo.getName()),
Review Comment:
Suggest use `userService.checkUser(approverEntity.getApprovers(),
userInfo.getName(), "Current user does not have permission to get this workflow
approver info")`
--
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]