You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2023/04/13 01:54:09 UTC
[inlong] branch master updated: [INLONG-7837][Manager] Fix the Admin user cannot modify streamSource when it is not the responsible person (#7838)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 1a82f43e8 [INLONG-7837][Manager] Fix the Admin user cannot modify streamSource when it is not the responsible person (#7838)
1a82f43e8 is described below
commit 1a82f43e83afa23485f401025c5bfb77ce1961e4
Author: fuweng11 <76...@users.noreply.github.com>
AuthorDate: Thu Apr 13 09:54:03 2023 +0800
[INLONG-7837][Manager] Fix the Admin user cannot modify streamSource when it is not the responsible person (#7838)
---
.../apache/inlong/manager/service/group/GroupCheckService.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/group/GroupCheckService.java b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/group/GroupCheckService.java
index 4ffa4f9d8..7bebd6970 100644
--- a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/group/GroupCheckService.java
+++ b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/group/GroupCheckService.java
@@ -19,10 +19,13 @@ package org.apache.inlong.manager.service.group;
import org.apache.inlong.manager.common.enums.ErrorCodeEnum;
import org.apache.inlong.manager.common.enums.GroupStatus;
+import org.apache.inlong.manager.common.enums.UserTypeEnum;
import org.apache.inlong.manager.common.exceptions.BusinessException;
import org.apache.inlong.manager.common.util.Preconditions;
import org.apache.inlong.manager.dao.entity.InlongGroupEntity;
+import org.apache.inlong.manager.dao.entity.UserEntity;
import org.apache.inlong.manager.dao.mapper.InlongGroupEntityMapper;
+import org.apache.inlong.manager.dao.mapper.UserEntityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -37,6 +40,8 @@ public class GroupCheckService {
@Autowired
private InlongGroupEntityMapper groupMapper;
+ @Autowired
+ private UserEntityMapper userMapper;
/**
* Check whether the inlong group status is temporary
@@ -50,8 +55,10 @@ public class GroupCheckService {
throw new BusinessException(String.format("InlongGroup does not exist with InlongGroupId=%s", groupId));
}
+ UserEntity userEntity = userMapper.selectByName(operator);
List<String> managers = Arrays.asList(inlongGroupEntity.getInCharges().split(","));
- Preconditions.expectTrue(managers.contains(operator),
+ Preconditions.expectTrue(
+ managers.contains(operator) || UserTypeEnum.ADMIN.getCode().equals(userEntity.getAccountType()),
String.format(ErrorCodeEnum.USER_IS_NOT_MANAGER.getMessage(), operator, managers));
GroupStatus status = GroupStatus.forCode(inlongGroupEntity.getStatus());