Skip to content

Commit

Permalink
fix(接口测试): 增加case复制权限
Browse files Browse the repository at this point in the history
--bug=1027247 --user=王孝刚 【接口测试】项目管理员开启创建接口权限但创建页面没有保存
https://www.tapd.cn/55049933/s/1385559
  • Loading branch information
wxg0103 authored and fit2-zhao committed Jun 25, 2023
1 parent ccaa19e commit 9933b47
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Expand Up @@ -14,6 +14,7 @@
import io.metersphere.api.service.*;
import io.metersphere.base.domain.*;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.QueryScheduleRequest;
Expand All @@ -22,6 +23,7 @@
import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.service.CheckPermissionService;
import io.metersphere.service.ScheduleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
Expand Down Expand Up @@ -398,6 +400,7 @@ public String historicalDataUpgrade(@RequestBody SaveHistoricalDataUpgrade reque
}

@PostMapping(value = "/genPerformanceTestXml", consumes = {"multipart/form-data"})
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_PERFORMANCE)
public JmxInfoDTO genPerformanceTest(@RequestPart("request") RunDefinitionRequest runRequest, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws Exception {
return apiTestService.getJmxInfoDTO(runRequest, bodyFiles);
}
Expand Down
Expand Up @@ -100,7 +100,7 @@ public List<ApiDefinitionResult> listBatch(@RequestBody ApiBatchRequest request)


@PostMapping(value = "/create", consumes = {"multipart/form-data"})
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API)
@RequiresPermissions(value = {PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API, PermissionConstants.PROJECT_API_DEFINITION_READ_COPY_API}, logical = Logical.OR)
@MsAuditLog(module = OperLogModule.API_DEFINITION, type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class)
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CREATE, subject = "接口定义通知")
public ApiDefinitionResult create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
Expand Down
Expand Up @@ -20,6 +20,7 @@
import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
import io.metersphere.track.service.TestPlanApiCaseService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
Expand Down Expand Up @@ -100,7 +101,7 @@ public List<ApiTestCaseInfo> getCaseBLOBs(@RequestBody ApiTestCaseRequest reques
}

@PostMapping(value = "/create", consumes = {"multipart/form-data"})
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_CASE)
@RequiresPermissions(value= {PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_CASE, PermissionConstants.PROJECT_API_DEFINITION_READ_COPY_CASE}, logical = Logical.OR)
@MsAuditLog(module = OperLogModule.API_DEFINITION_CASE, type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class)
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_CREATE, subject = "接口用例通知")
public ApiTestCase create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
Expand Down
Expand Up @@ -26,7 +26,7 @@
<!-- 保存操作 -->
<el-button type="primary" size="small" @click="saveTestCase()"
v-prevent-re-click
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']">
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE', 'PROJECT_API_DEFINITION:READ+CREATE_CASE', 'PROJECT_API_DEFINITION:READ+COPY_CASE']">
{{ saveButtonText }}
</el-button>
</el-col>
Expand Down

0 comments on commit 9933b47

Please sign in to comment.