diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.java index 37a827288d..9bcf3c2d7c 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.java @@ -2,6 +2,8 @@ package io.metersphere.system.mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + public interface ExtCheckOwnerMapper { - boolean checkoutOwner(@Param("table") String resourceType, @Param("projectId") String projectId, @Param("id") String id); + boolean checkoutOwner(@Param("table") String resourceType, @Param("projectId") String projectId, @Param("ids") List ids); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.xml index 87a60db473..3218b45798 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtCheckOwnerMapper.xml @@ -2,9 +2,12 @@ \ No newline at end of file diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/security/CheckOwnerAspect.java b/backend/services/system-setting/src/main/java/io/metersphere/system/security/CheckOwnerAspect.java index 7bfddf13cf..ba9b6df944 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/security/CheckOwnerAspect.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/security/CheckOwnerAspect.java @@ -22,6 +22,7 @@ import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.stereotype.Component; import java.lang.reflect.Method; +import java.util.List; @Aspect @@ -68,7 +69,12 @@ public class CheckOwnerAspect { Expression titleExp = parser.parseExpression(resourceId); Object v = titleExp.getValue(context, Object.class); if (v instanceof String id) { - if (!extCheckOwnerMapper.checkoutOwner(resourceType, SessionUtils.getCurrentProjectId(), id)) { + if (!extCheckOwnerMapper.checkoutOwner(resourceType, SessionUtils.getCurrentProjectId(), List.of(id))) { + throw new MSException(Translator.get("check_owner_case")); + } + } + if (v instanceof List ids) { + if (!extCheckOwnerMapper.checkoutOwner(resourceType, SessionUtils.getCurrentProjectId(), ids)) { throw new MSException(Translator.get("check_owner_case")); } }