diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index dcc61c4f93..8d9712671c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -2067,6 +2067,12 @@ public class ApiAutomationService { ApiScenarioWithBLOBs bloBs = getDto(object.getString("id")); if (bloBs == null) { object.put("referenced", "Copy"); + }else{ + CheckPermissionService checkPermissionService = CommonBeanFactory.getBean(CheckPermissionService.class); + Set userRelatedProjectIds = checkPermissionService.getUserRelatedProjectIds(); + if(!userRelatedProjectIds.contains(bloBs.getProjectId())){ + object.put("referenced", "Copy"); + } } } diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index b968a76fd1..4913828b10 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -688,11 +688,11 @@ export default { if (response.data) { workspaceId = response.data.workspaceId; isTurnSpace = true; - this.gotoTurn(resource, workspaceId, isTurnSpace); + this.checkPermission(resource, workspaceId, isTurnSpace); } }); } else { - this.gotoTurn(resource, workspaceId, isTurnSpace); + this.checkPermission(resource, workspaceId, isTurnSpace); } }, clickCase(resource) { @@ -757,6 +757,17 @@ export default { } }); } + }, + checkPermission(resource, workspaceId, isTurnSpace){ + this.$get('/project/getOwnerProjectIds', res => { + const project = res.data.find(p => p === resource.projectId); + if(!project){ + this.$warning(this.$t('commons.no_permission')); + }else{ + this.gotoTurn(resource, workspaceId, isTurnSpace) + } + + }) } } } diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue index 55cee3ca7c..3d09a19c71 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue @@ -264,11 +264,11 @@ export default { if (response.data) { workspaceId = response.data.workspaceId; isTurnSpace = true; - this.gotoTurn(resource,workspaceId,isTurnSpace); + this.checkPermission(resource,workspaceId,isTurnSpace); } }); }else { - this.gotoTurn(resource,workspaceId,isTurnSpace); + this.checkPermission(resource,workspaceId,isTurnSpace); } }, @@ -280,6 +280,16 @@ export default { if(isTurnSpace){ window.open(automationData.href, '_blank'); } + }, + checkPermission(resource,workspaceId,isTurnSpace){ + this.$get('/project/getOwnerProjectIds', res => { + const project = res.data.find(p => p === resource.projectId); + if(!project){ + this.$warning(this.$t('commons.no_permission')); + }else{ + this.gotoTurn(resource,workspaceId,isTurnSpace) + } + }) } }