From d50ffba69481b7d7543bc98f7686f4187781c961 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 9 May 2024 18:07:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E4=BC=9A=E6=8F=90=E7=A4=BA=E6=97=A0=E6=93=8D=E4=BD=9C=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/service/BaseProjectService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseProjectService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseProjectService.java index 05dd1d8947..3e24f24eb4 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseProjectService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseProjectService.java @@ -6,6 +6,7 @@ import io.metersphere.base.mapper.UserGroupMapper; import io.metersphere.base.mapper.UserMapper; import io.metersphere.base.mapper.ext.*; import io.metersphere.commons.constants.ProjectApplicationType; +import io.metersphere.commons.constants.UserGroupConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.JSON; @@ -240,6 +241,13 @@ public class BaseProjectService { public void checkProjectOwner(String projectId, List userGroups) { boolean hasPermission = false; + //如果是超级管理员 直接返回 + Optional any =userGroups.stream() + .filter(ug -> (ug.getGroupId().equals(UserGroupConstants.SUPER_GROUP))) + .findAny(); + if (any.isPresent()) { + return; + } for (UserGroup userGroup : userGroups) { // 校验是否有当前项目的用户组 if (StringUtils.equals(userGroup.getSourceId(), projectId)) {