fix(接口测试): 场景导入加判断_跳转加权限限制

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-03-29 15:41:01 +08:00 committed by 刘瑞斌
parent eab8c1f7bf
commit e94dba7de0
3 changed files with 31 additions and 4 deletions

View File

@ -2067,6 +2067,12 @@ public class ApiAutomationService {
ApiScenarioWithBLOBs bloBs = getDto(object.getString("id")); ApiScenarioWithBLOBs bloBs = getDto(object.getString("id"));
if (bloBs == null) { if (bloBs == null) {
object.put("referenced", "Copy"); object.put("referenced", "Copy");
}else{
CheckPermissionService checkPermissionService = CommonBeanFactory.getBean(CheckPermissionService.class);
Set<String> userRelatedProjectIds = checkPermissionService.getUserRelatedProjectIds();
if(!userRelatedProjectIds.contains(bloBs.getProjectId())){
object.put("referenced", "Copy");
}
} }
} }

View File

@ -688,11 +688,11 @@ export default {
if (response.data) { if (response.data) {
workspaceId = response.data.workspaceId; workspaceId = response.data.workspaceId;
isTurnSpace = true; isTurnSpace = true;
this.gotoTurn(resource, workspaceId, isTurnSpace); this.checkPermission(resource, workspaceId, isTurnSpace);
} }
}); });
} else { } else {
this.gotoTurn(resource, workspaceId, isTurnSpace); this.checkPermission(resource, workspaceId, isTurnSpace);
} }
}, },
clickCase(resource) { 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)
}
})
} }
} }
} }

View File

@ -264,11 +264,11 @@ export default {
if (response.data) { if (response.data) {
workspaceId = response.data.workspaceId; workspaceId = response.data.workspaceId;
isTurnSpace = true; isTurnSpace = true;
this.gotoTurn(resource,workspaceId,isTurnSpace); this.checkPermission(resource,workspaceId,isTurnSpace);
} }
}); });
}else { }else {
this.gotoTurn(resource,workspaceId,isTurnSpace); this.checkPermission(resource,workspaceId,isTurnSpace);
} }
}, },
@ -280,6 +280,16 @@ export default {
if(isTurnSpace){ if(isTurnSpace){
window.open(automationData.href, '_blank'); 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)
}
})
} }
} }