diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index ab00aaf2dc..cbb0fe8574 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -21,7 +21,7 @@ import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest; import io.metersphere.track.request.testplan.FileOperationRequest; import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -33,14 +33,13 @@ import java.util.List; @RestController @RequestMapping(value = "/api/automation") -@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) public class ApiAutomationController { @Resource ApiAutomationService apiAutomationService; @PostMapping("/list/{goPage}/{pageSize}") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ") public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiScenarioRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); @@ -48,26 +47,26 @@ public class ApiAutomationController { } @PostMapping("/list/all") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ") public List listAll(@RequestBody ApiScenarioBatchRequest request) { return apiAutomationService.listAll(request); } @PostMapping("/listWithIds/all") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ") public List listWithIds(@RequestBody ApiScenarioBatchRequest request) { return apiAutomationService.listWithIds(request); } @PostMapping("/id/all") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ") public List idAll(@RequestBody ApiScenarioBatchRequest request) { return apiAutomationService.idAll(request); } @GetMapping("/list/{projectId}") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ") public List list(@PathVariable String projectId) { ApiScenarioRequest request = new ApiScenarioRequest(); request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); @@ -77,6 +76,7 @@ public class ApiAutomationController { @PostMapping(value = "/create") @MsAuditLog(module = "api_automation", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiAutomationService.class) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+CREATE") public ApiScenario create(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "bodyFiles") List bodyFiles, @RequestPart(value = "scenarioFiles") List scenarioFiles) { return apiAutomationService.create(request, bodyFiles, scenarioFiles); @@ -84,6 +84,7 @@ public class ApiAutomationController { @PostMapping(value = "/update") @MsAuditLog(module = "api_automation", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiAutomationService.class) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+EDIT") public void update(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "bodyFiles") List bodyFiles, @RequestPart(value = "scenarioFiles") List scenarioFiles) { apiAutomationService.update(request, bodyFiles, scenarioFiles); @@ -91,6 +92,7 @@ public class ApiAutomationController { @GetMapping("/delete/{id}") @MsAuditLog(module = "api_automation", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiAutomationService.class) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+delete") public void delete(@PathVariable String id) { apiAutomationService.delete(id); } @@ -186,14 +188,14 @@ public class ApiAutomationController { } @PostMapping("/batch/edit") - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+EDIT") @MsAuditLog(module = "api_automation", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiAutomationService.class) public void bathEdit(@RequestBody ApiScenarioBatchRequest request) { apiAutomationService.bathEdit(request); } @PostMapping("/batch/update/env") - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+EDIT") @MsAuditLog(module = "api_automation", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiAutomationService.class) public void batchUpdateEnv(@RequestBody ApiScenarioBatchRequest request) { apiAutomationService.batchUpdateEnv(request); @@ -246,21 +248,21 @@ public class ApiAutomationController { } @PostMapping(value = "/import", consumes = {"multipart/form-data"}) - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+IMPORT_SCENARIO") @MsAuditLog(module = "api_automation", type = OperLogConstants.IMPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId") public ScenarioImport scenarioImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) { return apiAutomationService.scenarioImport(file, request); } @PostMapping(value = "/export") - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO") @MsAuditLog(module = "api_automation", type = OperLogConstants.EXPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId") public ApiScenrioExportResult export(@RequestBody ApiScenarioBatchRequest request) { return apiAutomationService.export(request); } @PostMapping(value = "/export/jmx") - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO") @MsAuditLog(module = "api_automation", type = OperLogConstants.EXPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId") public List exportJmx(@RequestBody ApiScenarioBatchRequest request) { return apiAutomationService.exportJmx(request); diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java index ff3e65dc1c..dc5334de76 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java @@ -20,7 +20,6 @@ import io.metersphere.base.domain.ApiDefinitionWithBLOBs; import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; import io.metersphere.base.domain.Schedule; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.json.JSONSchemaGenerator; import io.metersphere.commons.utils.CronUtils; import io.metersphere.commons.utils.PageUtils; @@ -32,9 +31,7 @@ import io.metersphere.service.CheckPermissionService; import io.metersphere.service.ScheduleService; import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest; import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -97,7 +94,7 @@ public class ApiDefinitionController { @PostMapping(value = "/create", consumes = {"multipart/form-data"}) - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+CREATE_API") @MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class) public void create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files") List bodyFiles) { checkPermissionService.checkProjectOwner(request.getProjectId()); @@ -105,7 +102,7 @@ public class ApiDefinitionController { } @PostMapping(value = "/update", consumes = {"multipart/form-data"}) - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+EDIT_API") @MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class) public ApiDefinitionWithBLOBs update(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files") List bodyFiles) { checkPermissionService.checkProjectOwner(request.getProjectId()); @@ -113,14 +110,14 @@ public class ApiDefinitionController { } @GetMapping("/delete/{id}") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+DELETE") @MsAuditLog(module = "api_definition", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiDefinitionService.class) public void delete(@PathVariable String id) { apiDefinitionService.delete(id); } @PostMapping("/deleteBatch") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+DELETE") @MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = ApiDefinitionService.class) public void deleteBatch(@RequestBody List ids) { apiDefinitionService.deleteBatch(ids); @@ -142,14 +139,14 @@ public class ApiDefinitionController { } @PostMapping("/removeToGc") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+DELETE") @MsAuditLog(module = "api_definition", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiDefinitionService.class) public void removeToGc(@RequestBody List ids) { apiDefinitionService.removeToGc(ids); } @PostMapping("/removeToGcByParams") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+DELETE") @MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_GC, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = ApiDefinitionService.class) public void removeToGcByParams(@RequestBody ApiBatchRequest request) { apiDefinitionService.removeToGcByParams(request); @@ -195,14 +192,14 @@ public class ApiDefinitionController { } @PostMapping(value = "/import", consumes = {"multipart/form-data"}) - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+IMPORT_API") @MsAuditLog(module = "api_definition", type = OperLogConstants.IMPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId") public ApiDefinitionImport testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) { return apiDefinitionService.apiTestImport(file, request); } @PostMapping(value = "/export/{type}") - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+EXPORT_API") @MsAuditLog(module = "api_definition", type = OperLogConstants.EXPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId") public ApiExportResult export(@RequestBody ApiBatchRequest request, @PathVariable String type) { return apiDefinitionService.export(request, type); @@ -262,13 +259,13 @@ public class ApiDefinitionController { } @PostMapping("/batch/edit") - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+EDIT_API") public void editApiBath(@RequestBody ApiBatchRequest request) { apiDefinitionService.editApiBath(request); } @PostMapping("/batch/editByParams") - @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+EDIT_API") @MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request)", content = "#msClass.getLogDetails(#request)", msClass = ApiDefinitionService.class) public void editByParams(@RequestBody ApiBatchRequest request) { apiDefinitionService.editApiByParam(request); @@ -291,7 +288,7 @@ public class ApiDefinitionController { } @GetMapping("/export/esbExcelTemplate") - @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + @RequiresPermissions("PROJECT_API_DEFINITION:READ+EXPORT_API") public void testCaseTemplateExport(HttpServletResponse response) { esbImportService.templateExport(response); } diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index 2075188f17..d751561111 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -41,7 +41,8 @@ :name="item.name" closable>
-
@@ -51,7 +52,10 @@ - {{ $t('api_test.automation.add_scenario') }} + + {{ $t('api_test.automation.add_scenario') }} + {{ $t('api_test.definition.request.close_all_label') }} @@ -65,13 +69,13 @@ diff --git a/frontend/src/business/components/api/automation/report/ApiReportList.vue b/frontend/src/business/components/api/automation/report/ApiReportList.vue index 0959d8e436..30c288ea99 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportList.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportList.vue @@ -61,6 +61,7 @@ diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 0b1f7b8fdf..00ef958ea9 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -25,7 +25,8 @@ @@ -173,718 +178,739 @@ - + diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue index c6b48f0196..e53456519a 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue @@ -89,14 +89,17 @@ operators: [ { label: this.$t('api_test.automation.add_scenario'), - callback: this.addScenario + callback: this.addScenario, + permissions: ['PROJECT_API_SCENARIO:READ+CREATE'] }, { label: this.$t('api_test.api_import.label'), - callback: this.handleImport + callback: this.handleImport, + permissions: ['PROJECT_API_SCENARIO:READ+IMPORT_SCENARIO'] }, { label: this.$t('report.export'), + permissions: ['PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO'], children: [ { label: this.$t('report.export_to_ms_format'), diff --git a/frontend/src/business/components/api/automation/scenario/ScenarioExtendBtns.vue b/frontend/src/business/components/api/automation/scenario/ScenarioExtendBtns.vue index 68837e9226..1e8df490c4 100644 --- a/frontend/src/business/components/api/automation/scenario/ScenarioExtendBtns.vue +++ b/frontend/src/business/components/api/automation/scenario/ScenarioExtendBtns.vue @@ -6,8 +6,11 @@ {{ $t('api_test.automation.view_ref') }} - {{ $t('api_test.automation.schedule') }} - + + {{ $t('api_test.automation.schedule') }} + + {{ $t('api_test.create_performance_test') }} @@ -19,68 +22,68 @@ diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index ec009382c5..a012a7c71b 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -84,13 +84,17 @@
- - - -
@@ -119,8 +123,12 @@ - {{ $t('api_test.definition.request.fast_debug') }} - {{ $t('api_test.definition.request.title') }} + + {{ $t('api_test.definition.request.fast_debug') }} + + + {{ $t('api_test.definition.request.title') }} + {{ $t('api_test.definition.request.close_all_label') }} @@ -136,382 +144,388 @@ diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index f8141596e5..117f519d4d 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -194,18 +194,7 @@ import MsTableAdvSearchBar from "@/business/components/common/components/search/ import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/search/search-components"; import MsTipButton from "@/business/components/common/components/MsTipButton"; import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove"; -import { - _filter, - _handleSelect, - _handleSelectAll, - _sort, - buildBatchParam, deepClone, - getLabel, - getSelectDataCounts, - initCondition, - setUnSelectIds, - toggleAllSelection -} from "@/common/js/tableUtils"; +import {_filter, _sort, buildBatchParam, getLabel, initCondition} from "@/common/js/tableUtils"; import {Api_List} from "@/business/components/common/model/JsonData"; import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; @@ -251,31 +240,90 @@ export default { selectDataRange: "all", deletePath: "/test/case/delete", buttons: [ - {name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch}, - {name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}, { - name: this.$t('api_test.definition.request.batch_move'), handleClick: this.handleBatchMove + name: this.$t('api_test.definition.request.batch_delete'), + handleClick: this.handleDeleteBatch, + permissions: ['PROJECT_API_DEFINITION:READ+DELETE_API'] + }, + { + name: this.$t('api_test.definition.request.batch_edit'), + handleClick: this.handleEditBatch, + permissions: ['PROJECT_API_DEFINITION:READ+EDIT_API'] + }, + { + name: this.$t('api_test.definition.request.batch_move'), + handleClick: this.handleBatchMove, + permissions: ['PROJECT_API_DEFINITION:READ+BATCH_MOVE'] } ], trashButtons: [ - {name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch}, + { + name: this.$t('api_test.definition.request.batch_delete'), + handleClick: this.handleDeleteBatch, + permissions: ['PROJECT_API_DEFINITION:READ+DELETE_API'] + }, { name: "批量恢复", handleClick: this.handleBatchRestore }, ], tableOperatorButtons: [], tableUsualOperatorButtons: [ - {tip: this.$t('api_test.automation.execute'), icon: "el-icon-video-play", exec: this.runApi}, - {tip: this.$t('commons.edit'), icon: "el-icon-edit", exec: this.editApi}, - {tip: "CASE", exec: this.handleTestCase, isDivButton: true, type: "primary"}, - {tip: this.$t('commons.delete'), exec: this.handleDelete, icon: "el-icon-delete", type: "danger"}, - {tip: this.$t('commons.copy'), exec: this.handleCopy, icon: "el-icon-document-copy", type: "primary"}, + { + tip: this.$t('api_test.automation.execute'), + icon: "el-icon-video-play", + exec: this.runApi, + permissions: ['PROJECT_API_DEFINITION:READ+RUN'] + }, + { + tip: this.$t('commons.edit'), + icon: "el-icon-edit", + exec: this.editApi, + permissions: ['PROJECT_API_DEFINITION:READ+EDIT_API'] + }, + { + tip: "CASE", + exec: this.handleTestCase, + isDivButton: true, + type: "primary", + permissions: ['PROJECT_API_DEFINITION:READ+CREATE_CASE'] + }, + { + tip: this.$t('commons.delete'), + exec: this.handleDelete, + icon: "el-icon-delete", + type: "danger", + permissions: ['PROJECT_API_DEFINITION:READ+DELETE_API'] + }, + { + tip: this.$t('commons.copy'), + exec: this.handleCopy, + icon: "el-icon-document-copy", + type: "primary", + permissions: ['PROJECT_API_DEFINITION:READ+COPY'] + }, ], tableTrashOperatorButtons: [ - {tip: this.$t('api_test.automation.execute'), icon: "el-icon-video-play", exec: this.runApi}, + { + tip: this.$t('api_test.automation.execute'), + icon: "el-icon-video-play", + exec: this.runApi, + permissions: ['PROJECT_API_DEFINITION:READ+RUN'] + }, {tip: this.$t('commons.reduction'), icon: "el-icon-refresh-left", exec: this.reductionApi}, - {tip: "CASE", exec: this.handleTestCase, isDivButton: true, type: "primary"}, - {tip: this.$t('commons.delete'), exec: this.handleDelete, icon: "el-icon-delete", type: "danger"}, + { + tip: "CASE", + exec: this.handleTestCase, + isDivButton: true, + type: "primary", + permissions: ['PROJECT_API_DEFINITION:READ+CREATE_CASE'] + }, + { + tip: this.$t('commons.delete'), + exec: this.handleDelete, + icon: "el-icon-delete", + type: "danger", + permissions: ['PROJECT_API_DEFINITION:READ+DELETE_API'] + }, ], typeArr: [ {id: 'status', name: this.$t('api_test.definition.api_status')}, @@ -321,7 +369,7 @@ export default { screenHeight: document.documentElement.clientHeight - 310,//屏幕高度, environmentId: undefined, selectDataCounts: 0, - } + }; }, props: { currentProtocol: String, @@ -347,13 +395,13 @@ export default { moduleTree: { type: Array, default() { - return [] + return []; }, }, moduleOptions: { type: Array, default() { - return [] + return []; }, } }, @@ -453,7 +501,7 @@ export default { if (item.tags && item.tags.length > 0) { item.tags = JSON.parse(item.tags); } - }) + }); // nexttick:表格加载完成之后触发。判断是否需要勾选行 this.$nextTick(function () { @@ -461,7 +509,7 @@ export default { this.$refs.apiDefinitionTable.checkTableRowIsSelect(); this.$refs.apiDefinitionTable.doLayout(); } - }) + }); }); } getLabel(this, API_LIST); @@ -513,7 +561,7 @@ export default { this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => { this.valueArr.userId = response.data; this.userFilters = response.data.map(u => { - return {text: u.name, value: u.id} + return {text: u.name, value: u.id}; }); }); }, @@ -562,8 +610,8 @@ export default { } response.body = body; } - row.request = request - row.response = response + row.request = request; + row.response = response; this.$emit('runTest', row); }, reductionApi(row) { @@ -706,7 +754,7 @@ export default { this.$emit("changeSelectDataRangeAll", "api"); }, getIds(rowSets) { - let rowArray = Array.from(rowSets) + let rowArray = Array.from(rowSets); let ids = rowArray.map(s => s.id); return ids; }, @@ -739,7 +787,7 @@ export default { if (api.moduleId === item.id) { api.modulePath = item.path; } - }) + }); }); } catch (e) { console.log(e); @@ -773,7 +821,7 @@ export default { return row[property] === value; } }, -} +}; diff --git a/frontend/src/business/components/common/components/search/MsSearchBar.vue b/frontend/src/business/components/common/components/search/MsSearchBar.vue index 33784e7370..1da3aedfb6 100644 --- a/frontend/src/business/components/common/components/search/MsSearchBar.vue +++ b/frontend/src/business/components/common/components/search/MsSearchBar.vue @@ -7,7 +7,9 @@ - + {{ item.label }} diff --git a/frontend/src/common/js/utils.js b/frontend/src/common/js/utils.js index 2adccf686c..ab2a42ecf9 100644 --- a/frontend/src/common/js/utils.js +++ b/frontend/src/common/js/utils.js @@ -96,7 +96,7 @@ export function hasPermission(permission) { } let systemPermissions = user.userGroups.filter(gp => gp.group.type === 'SYSTEM') - .filter(ug => ug.sourceId === 'system')[0]?.userGroupPermissions + .filter(ug => ug.sourceId === 'system' || ug.sourceId === 'adminSourceId')[0]?.userGroupPermissions .map(g => g.permissionId) || []; for (const p of systemPermissions) {