diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java index 100f471413..c9c9bf13bf 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java @@ -338,5 +338,23 @@ public class PermissionConstants { /*------ start: ORGANIZATION_TASK_CENTER_READ ------*/ public static final String ORGANIZATION_TASK_CENTER_READ = "ORGANIZATION_TASK_CENTER:READ"; public static final String ORGANIZATION_TASK_CENTER_READ_STOP = "ORGANIZATION_TASK_CENTER:READ+STOP"; + + public static final String ORGANIZATION_CASE_TASK_CENTER_READ = "ORGANIZATION_CASE_TASK_CENTER:READ"; + public static final String ORGANIZATION_CASE_TASK_CENTER_EXEC_STOP = "ORGANIZATION_CASE_TASK_CENTER:EXEC+STOP"; + public static final String ORGANIZATION_CASE_TASK_CENTER_DELETE = "ORGANIZATION_CASE_TASK_CENTER:READ+DELETE"; + //后台任务 + public static final String ORGANIZATION_SCHEDULE_TASK_CENTER_READ = "ORGANIZATION_SCHEDULE_TASK_CENTER:READ"; + public static final String ORGANIZATION_SCHEDULE_TASK_CENTER_READ_UPDATE = "ORGANIZATION_SCHEDULE_TASK_CENTER:READ+UPDATE"; + public static final String ORGANIZATION_SCHEDULE_TASK_CENTER_READ_DELETE = "ORGANIZATION_SCHEDULE_TASK_CENTER:READ+DELETE"; + /*------ end: ORGANIZATION_TASK_CENTER_READ ------*/ + + /*------ start: PROJECT_TASK_CENTER_READ ------*/ + public static final String PROJECT_CASE_TASK_CENTER_READ = "PROJECT_CASE_TASK_CENTER:READ"; + public static final String PROJECT_CASE_TASK_CENTER_EXEC_STOP = "PROJECT_CASE_TASK_CENTER:EXEC+STOP"; + public static final String PROJECT_CASE_TASK_CENTER_DELETE = "PROJECT_CASE_TASK_CENTER:READ+DELETE"; + public static final String PROJECT_SCHEDULE_TASK_CENTER_READ = "PROJECT_SCHEDULE_TASK_CENTER:READ"; + public static final String PROJECT_SCHEDULE_TASK_CENTER_READ_UPDATE = "PROJECT_SCHEDULE_TASK_CENTER:READ+UPDATE"; + public static final String PROJECT_SCHEDULE_TASK_CENTER_READ_DELETE = "PROJECT_SCHEDULE_TASK_CENTER:READ+DELETE"; + /*------ end: PROJECT_TASK_CENTER_READ ------*/ } diff --git a/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties index 5034abb8f9..ef9eac3bab 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties @@ -600,4 +600,10 @@ custom_function_already_exist= custom function name already exist permission.project_custom_function.name=Common script permission.project_custom_function.execute=Test -message.domain.report.name=Report name \ No newline at end of file +message.domain.report.name=Report name + + +permission.project_task_center.name=Task center +permission.project_case_task_center.name=Case task +permission.project_schedule_task_center.name=Schedule task +permission.project_case_task_center.exec=exec/stop \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties index 0cbfc350fc..0e60eb7bdf 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties @@ -599,4 +599,9 @@ custom_function_already_exist= 脚本名称已存在 permission.project_custom_function.name=公共脚本 permission.project_custom_function.execute=测试 -message.domain.report.name=报告名称 \ No newline at end of file +message.domain.report.name=报告名称 + +permission.project_task_center.name=任务中心 +permission.project_case_task_center.name=用例执行任务 +permission.project_schedule_task_center.name=系统后台任务 +permission.project_case_task_center.exec=执行/停止 \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties index d493281155..60e9e4b580 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties @@ -599,4 +599,9 @@ custom_function_already_exist= 腳本名稱已存在 permission.project_custom_function.name=公共腳本 permission.project_custom_function.execute=測試 -message.domain.report.name=報告名稱 \ No newline at end of file +message.domain.report.name=報告名稱 + +permission.project_task_center.name=任務中心 +permission.project_case_task_center.name=用例執行任務 +permission.project_schedule_task_center.name=系統後臺任務 +permission.project_case_task_center.exec=執行/停止 \ No newline at end of file diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java index 7d71a91f7d..9cf93b3b9e 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTaskHubController.java @@ -30,13 +30,14 @@ public class ProjectTaskHubController { @PostMapping("/exec-task/page") @Operation(summary = "项目-任务中心-执行任务列表") + @RequiresPermissions(PermissionConstants.PROJECT_CASE_TASK_CENTER_READ) public Pager> projectList(@Validated @RequestBody BasePageRequest request) { return baseTaskHubService.getTaskList(request, null, SessionUtils.getCurrentProjectId()); } @PostMapping("/schedule/page") @Operation(summary = "项目-任务中心-后台执行任务列表") - @RequiresPermissions(PermissionConstants.SYSTEM_SCHEDULE_TASK_CENTER_READ) + @RequiresPermissions(PermissionConstants.PROJECT_SCHEDULE_TASK_CENTER_READ) public Pager> scheduleList(@Validated @RequestBody BasePageRequest request) { return baseTaskHubService.getScheduleTaskList(request, List.of(SessionUtils.getCurrentProjectId())); } diff --git a/backend/services/project-management/src/main/resources/permission.json b/backend/services/project-management/src/main/resources/permission.json index afba544480..bdb26b2d3b 100644 --- a/backend/services/project-management/src/main/resources/permission.json +++ b/backend/services/project-management/src/main/resources/permission.json @@ -205,5 +205,43 @@ ] } ] + }, + { + "id": "PROJECT_TASK_CENTER", + "name": "permission.project_task_center.name", + "type": "PROJECT", + "children": [ + { + "id": "PROJECT_CASE_TASK_CENTER", + "name": "permission.project_case_task_center.name", + "permissions": [ + { + "id": "PROJECT_CASE_TASK_CENTER:READ" + }, + { + "id": "PROJECT_CASE_TASK_CENTER:EXEC+STOP", + "name": "permission.project_case_task_center.exec" + }, + { + "id": "PROJECT_CASE_TASK_CENTER:READ+DELETE" + } + ] + }, + { + "id": "PROJECT_SCHEDULE_TASK_CENTER", + "name": "permission.project_schedule_task_center.name", + "permissions": [ + { + "id": "PROJECT_SCHEDULE_TASK_CENTER:READ" + }, + { + "id": "PROJECT_SCHEDULE_TASK_CENTER:READ+UPDATE" + }, + { + "id": "PROJECT_SCHEDULE_TASK_CENTER:READ+DELETE" + } + ] + } + ] } ] \ No newline at end of file diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java index 1143626b92..9f43044fa7 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectUserRoleControllerTests.java @@ -235,7 +235,7 @@ public class ProjectUserRoleControllerTests extends BaseTest { // 返回请求正常 Assertions.assertNotNull(resultHolder); // 返回总条数是否为init_project_user_role.sql中的数据总数 - Assertions.assertEquals(1, JSON.parseArray(JSON.toJSONString(resultHolder.getData())).size()); + Assertions.assertEquals(2, JSON.parseArray(JSON.toJSONString(resultHolder.getData())).size()); // 权限校验 requestGetPermissionTest(PermissionConstants.PROJECT_GROUP_READ, PROJECT_USER_ROLE_PERMISSION_SETTING + "/default-pro-role-id-3"); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java index 17d06333bf..0cdb13f8a0 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationTaskHubController.java @@ -33,7 +33,7 @@ public class OrganizationTaskHubController { @PostMapping("/exec-task/page") @Operation(summary = "组织-任务中心-执行任务列表") - @RequiresPermissions(PermissionConstants.ORGANIZATION_TASK_CENTER_READ) + @RequiresPermissions(PermissionConstants.ORGANIZATION_CASE_TASK_CENTER_READ) public Pager> projectList(@Validated @RequestBody BasePageRequest request) { return baseTaskHubService.getTaskList(request, SessionUtils.getCurrentOrganizationId(), null); } @@ -41,7 +41,7 @@ public class OrganizationTaskHubController { @PostMapping("/schedule/page") @Operation(summary = "组织-任务中心-后台执行任务列表") - @RequiresPermissions(PermissionConstants.SYSTEM_SCHEDULE_TASK_CENTER_READ) + @RequiresPermissions(PermissionConstants.ORGANIZATION_SCHEDULE_TASK_CENTER_READ) public Pager> scheduleList(@Validated @RequestBody BasePageRequest request) { List projectList = baseProjectMapper.getProjectOptionsByOrgId(SessionUtils.getCurrentOrganizationId()); List projectIds = projectList.stream().map(OptionDTO::getId).toList(); diff --git a/backend/services/system-setting/src/main/resources/permission.json b/backend/services/system-setting/src/main/resources/permission.json index 50eda8dad9..5f39647acf 100644 --- a/backend/services/system-setting/src/main/resources/permission.json +++ b/backend/services/system-setting/src/main/resources/permission.json @@ -370,11 +370,28 @@ "name": "permission.organization_task_center.name", "permissions": [ { - "id": "ORGANIZATION_TASK_CENTER:READ" + "id": "ORGANIZATION_CASE_TASK_CENTER:READ", + "name": "permission.case_task_center.read" }, { - "id": "ORGANIZATION_TASK_CENTER:READ+STOP", - "name": "permission.organization_task_center.stop" + "id": "ORGANIZATION_CASE_TASK_CENTER:EXEC+STOP", + "name": "permission.case_task_center.exec" + }, + { + "id": "ORGANIZATION_CASE_TASK_CENTER:READ+DELETE", + "name": "permission.case_task_center.delete" + }, + { + "id": "ORGANIZATION_SCHEDULE_TASK_CENTER:READ", + "name": "permission.schedule_task_center.read" + }, + { + "id": "ORGANIZATION_SCHEDULE_TASK_CENTER:READ+UPDATE", + "name": "permission.schedule_task_center.update" + }, + { + "id": "ORGANIZATION_SCHEDULE_TASK_CENTER:READ+DELETE", + "name": "permission.schedule_task_center.delete" } ] }