fix(项目设置): 创建和编辑项目操作没有获取模板的权限

--bug=1026904 --user=陈建星 【系统设置】 创建项目和编辑无权限的项目时提示 接口模块无权限等错误信息 https://www.tapd.cn/55049933/s/1380699
This commit is contained in:
chenjianxing 2023-06-12 17:10:21 +08:00 committed by 刘瑞斌
parent a9b0ae3a61
commit bc1c06715f
3 changed files with 9 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.ApiTemplate;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.dto.ApiTemplateDTO;
@ -55,13 +56,15 @@ public class ApiTemplateController {
}
@GetMapping({"/option/{projectId}", "/option"})
@RequiresPermissions(value = {"PROJECT_TEMPLATE:READ+API_TEMPLATE", "PROJECT_TEMPLATE:READ"}, logical = Logical.OR)
@RequiresPermissions(value = {"PROJECT_TEMPLATE:READ+API_TEMPLATE", "PROJECT_TEMPLATE:READ",
PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_CREATE, PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_EDIT}, logical = Logical.OR)
public List<ApiTemplate> list(@PathVariable(required = false) String projectId) {
return apiTemplateService.getOption(projectId);
}
@GetMapping("/get-template/relate/{projectId}")
@RequiresPermissions(value = {"PROJECT_TEMPLATE:READ+API_TEMPLATE", "PROJECT_TEMPLATE:READ"}, logical = Logical.OR)
@RequiresPermissions(value = {"PROJECT_TEMPLATE:READ+API_TEMPLATE", "PROJECT_TEMPLATE:READ",
PermissionConstants.PROJECT_API_DEFINITION_READ}, logical = Logical.OR)
public ApiTemplateDTO getTemplate(@PathVariable String projectId) {
return apiTemplateService.getTemplate(projectId);
}

View File

@ -60,7 +60,8 @@ public class IssueTemplateController {
}
@GetMapping({"/option/{projectId}", "/option"})
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_READ_ISSUE_TEMPLATE)
@RequiresPermissions(value = {PermissionConstants.PROJECT_TEMPLATE_READ_ISSUE_TEMPLATE,
PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_CREATE, PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_EDIT}, logical = Logical.OR)
public List<IssueTemplate> list(@PathVariable(required = false) String projectId) {
return issueTemplateService.getOption(projectId);
}

View File

@ -58,7 +58,8 @@ public class TestCaseTemplateController {
}
@GetMapping({"/option/{projectId}", "/option"})
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_READ_CASE_TEMPLATE)
@RequiresPermissions(value = {PermissionConstants.PROJECT_TEMPLATE_READ_CASE_TEMPLATE,
PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_CREATE, PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_EDIT}, logical = Logical.OR)
public List<TestCaseTemplate> list(@PathVariable(required = false) String projectId) {
return testCaseTemplateService.getOption(projectId);
}