fix(项目设置): 自定义字段权限设置有误
This commit is contained in:
parent
825aea38d2
commit
dff24b5194
|
@ -192,13 +192,6 @@ public class PermissionConstants {
|
|||
public static final String PROJECT_FILE_MANAGEMENT_READ_DOWNLOAD = "PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD";
|
||||
public static final String PROJECT_FILE_MANAGEMENT_READ_DELETE = "PROJECT_FILE_MANAGEMENT:READ+DELETE";
|
||||
|
||||
/*------ start: PROJECT_CUSTOM_FIELD ------*/
|
||||
public static final String PROJECT_CUSTOM_FIELD_READ = "PROJECT_CUSTOM_FIELD:READ";
|
||||
public static final String PROJECT_CUSTOM_FIELD_ADD = "PROJECT_CUSTOM_FIELD:READ+ADD";
|
||||
public static final String PROJECT_CUSTOM_FIELD_UPDATE = "PROJECT_CUSTOM_FIELD:READ+UPDATE";
|
||||
public static final String PROJECT_CUSTOM_FIELD_DELETE = "PROJECT_CUSTOM_FIELD:READ+DELETE";
|
||||
/*------ end: PROJECT_CUSTOM_FIELD ------*/
|
||||
|
||||
/*------ start: PROJECT_CUSTOM_FUNCTION------*/
|
||||
public static final String PROJECT_CUSTOM_FUNCTION_READ = "PROJECT_CUSTOM_FUNCTION:READ";
|
||||
public static final String PROJECT_CUSTOM_FUNCTION_ADD = "PROJECT_CUSTOM_FUNCTION:READ+ADD";
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ProjectCustomFieldController {
|
|||
|
||||
@GetMapping("/list/{projectId}/{scene}")
|
||||
@Operation(summary = "获取自定义字段列表")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_CUSTOM_FIELD_READ)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_READ)
|
||||
public List<CustomFieldDTO> list(@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@PathVariable String projectId,
|
||||
@Schema(description = "模板的使用场景(FUNCTIONAL,BUG,API,UI,TEST_PLAN)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
@ -46,14 +46,14 @@ public class ProjectCustomFieldController {
|
|||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "获取自定义字段详情")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_CUSTOM_FIELD_READ)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_READ)
|
||||
public CustomFieldDTO get(@PathVariable String id) {
|
||||
return projectCustomFieldService.getCustomFieldDTOWithCheck(id);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "创建自定义字段")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_CUSTOM_FIELD_ADD)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_ADD)
|
||||
@Log(type = OperationLogType.ADD, expression = "#msClass.addLog(#request)", msClass = ProjectCustomFieldLogService.class)
|
||||
public CustomField add(@Validated({Created.class}) @RequestBody CustomFieldUpdateRequest request) {
|
||||
CustomField customField = new CustomField();
|
||||
|
@ -64,7 +64,7 @@ public class ProjectCustomFieldController {
|
|||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "更新自定义字段")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_CUSTOM_FIELD_UPDATE)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#request)", msClass = ProjectCustomFieldLogService.class)
|
||||
public CustomField update(@Validated({Updated.class}) @RequestBody CustomFieldUpdateRequest request) {
|
||||
CustomField customField = new CustomField();
|
||||
|
@ -74,7 +74,7 @@ public class ProjectCustomFieldController {
|
|||
|
||||
@GetMapping("/delete/{id}")
|
||||
@Operation(summary = "删除自定义字段")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_CUSTOM_FIELD_DELETE)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TEMPLATE_DELETE)
|
||||
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#id)", msClass = ProjectCustomFieldLogService.class)
|
||||
public void delete(@PathVariable String id) {
|
||||
projectCustomFieldService.delete(id);
|
||||
|
|
|
@ -147,7 +147,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
// @@异常参数校验
|
||||
createdGroupParamValidateTest(CustomFieldUpdateRequestDefinition.class, DEFAULT_ADD);
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.PROJECT_CUSTOM_FIELD_ADD, DEFAULT_ADD, request);
|
||||
requestPostPermissionTest(PermissionConstants.PROJECT_TEMPLATE_ADD, DEFAULT_ADD, request);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -215,7 +215,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
// @@异常参数校验
|
||||
updatedGroupParamValidateTest(CustomFieldUpdateRequestDefinition.class, DEFAULT_UPDATE);
|
||||
// @@校验权限
|
||||
requestPostPermissionTest(PermissionConstants.PROJECT_CUSTOM_FIELD_UPDATE, DEFAULT_UPDATE, request);
|
||||
requestPostPermissionTest(PermissionConstants.PROJECT_TEMPLATE_UPDATE, DEFAULT_UPDATE, request);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -260,7 +260,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
assertErrorCode(this.requestGet(LIST, DEFAULT_PROJECT_ID, "111"), TEMPLATE_SCENE_ILLEGAL);
|
||||
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_CUSTOM_FIELD_READ, LIST, DEFAULT_PROJECT_ID, scene);
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_TEMPLATE_READ, LIST, DEFAULT_PROJECT_ID, scene);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -277,7 +277,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
Assertions.assertEquals(options, baseCustomFieldOptionService.getByFieldId(customField.getId()));
|
||||
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_CUSTOM_FIELD_READ, DEFAULT_GET, customFieldDTO.getId());
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_TEMPLATE_READ, DEFAULT_GET, customFieldDTO.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -307,7 +307,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
// @@校验日志
|
||||
checkLog(addCustomField.getId(), OperationLogType.DELETE);
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_CUSTOM_FIELD_DELETE, DEFAULT_DELETE, addCustomField.getId());
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_TEMPLATE_DELETE, DEFAULT_DELETE, addCustomField.getId());
|
||||
}
|
||||
|
||||
private void changeOrgTemplateEnable(boolean enable) {
|
||||
|
|
Loading…
Reference in New Issue