fix(接口测试): 修复超级管理员会提示无操作权限的缺陷

This commit is contained in:
wxg0103 2024-05-09 18:07:58 +08:00 committed by 刘瑞斌
parent a14e604d12
commit d50ffba694
1 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import io.metersphere.base.mapper.UserGroupMapper;
import io.metersphere.base.mapper.UserMapper; import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.ext.*; import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.ProjectApplicationType; import io.metersphere.commons.constants.ProjectApplicationType;
import io.metersphere.commons.constants.UserGroupConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.JSON;
@ -240,6 +241,13 @@ public class BaseProjectService {
public void checkProjectOwner(String projectId, List<UserGroup> userGroups) { public void checkProjectOwner(String projectId, List<UserGroup> userGroups) {
boolean hasPermission = false; boolean hasPermission = false;
//如果是超级管理员 直接返回
Optional<UserGroup> any =userGroups.stream()
.filter(ug -> (ug.getGroupId().equals(UserGroupConstants.SUPER_GROUP)))
.findAny();
if (any.isPresent()) {
return;
}
for (UserGroup userGroup : userGroups) { for (UserGroup userGroup : userGroups) {
// 校验是否有当前项目的用户组 // 校验是否有当前项目的用户组
if (StringUtils.equals(userGroup.getSourceId(), projectId)) { if (StringUtils.equals(userGroup.getSourceId(), projectId)) {