From e02e799fc585758ce3ad87c7fc9c7729fc0a83fc Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Thu, 24 Aug 2023 10:48:09 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E6=97=A5=E5=BF=97=E6=9D=83=E9=99=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/sdk/constants/PermissionConstants.java | 4 ++-- .../system/controller/OperationLogController.java | 6 +++--- .../system/controller/OrganizationLogController.java | 6 +++--- .../system-setting/src/main/resources/permission.json | 8 ++++---- .../system/controller/OperationLogControllerTests.java | 10 +++++----- .../controller/OrganizationLogControllerTests.java | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) 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 0021c86524..3f2993b8fd 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 @@ -105,7 +105,7 @@ public class PermissionConstants { public static final String SYSTEM_AUTH_READ = "SYSTEM_AUTH:READ"; public static final String SYSTEM_AUTH_READ_UPDATE = "SYSTEM_AUTH:READ+UPDATE"; - public static final String SYSTEM_OPERATING_LOG_READ = "SYSTEM_OPERATING_LOG:READ"; + public static final String SYSTEM_LOG_READ = "SYSTEM_LOG:READ"; public static final String ORGANIZATION_SERVICE_READ = "ORGANIZATION_SERVICE:READ"; public static final String ORGANIZATION_SERVICE_READ_UPDATE = "ORGANIZATION_SERVICE:READ+UPDATE"; @@ -123,7 +123,7 @@ public class PermissionConstants { public static final String ORGANIZATION_PROJECT_ENVIRONMENT_READ_IMPORT = "ORGANIZATION_PROJECT_ENVIRONMENT:READ+IMPORT"; public static final String ORGANIZATION_PROJECT_ENVIRONMENT_READ_EXPORT = "ORGANIZATION_PROJECT_ENVIRONMENT:READ+EXPORT"; - public static final String ORGANIZATION_OPERATING_LOG_READ = "ORGANIZATION_OPERATING_LOG:READ"; + public static final String ORGANIZATION_LOG_READ = "ORGANIZATION_LOG:READ"; public static final String PROJECT_USER_READ = "PROJECT_USER:READ"; public static final String PROJECT_USER_READ_ADD = "PROJECT_USER:READ+ADD"; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OperationLogController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OperationLogController.java index fa4f655de3..f738d847f7 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OperationLogController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OperationLogController.java @@ -45,7 +45,7 @@ public class OperationLogController { @GetMapping("/get/options") @Operation(summary = "获取组织/项目级联下拉框选项") - @RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ) + @RequiresPermissions(PermissionConstants.SYSTEM_LOG_READ) public OrganizationProjectOptionsResponse getOptions() { //获取全部组织 @@ -63,7 +63,7 @@ public class OperationLogController { @PostMapping("/list") @Operation(summary = "系统操作日志列表查询") - @RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ) + @RequiresPermissions(PermissionConstants.SYSTEM_LOG_READ) public Pager> list(@Validated @RequestBody OperationLogRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc"); @@ -73,7 +73,7 @@ public class OperationLogController { @GetMapping("/user/list") @Operation(summary = "系统日志页面,获取用户列表") - @RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ) + @RequiresPermissions(PermissionConstants.SYSTEM_LOG_READ) public List getUserList() { List userList = userService.getUserList(); return userList; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java index eacc12dd9a..7dea0269b8 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/OrganizationLogController.java @@ -48,7 +48,7 @@ public class OrganizationLogController { @GetMapping("/get/options/{organizationId}") @Operation(summary = "组织日志-获取项目级联下拉框选项") - @RequiresPermissions(PermissionConstants.ORGANIZATION_OPERATING_LOG_READ) + @RequiresPermissions(PermissionConstants.ORGANIZATION_LOG_READ) public OrganizationProjectOptionsResponse getOrganizationOptions(@PathVariable(value = "organizationId") String organizationId) { //获取全部项目 List projectList = systemProjectService.getProjectOptions(organizationId); @@ -61,7 +61,7 @@ public class OrganizationLogController { @GetMapping("/user/list/{organizationId}") @Operation(summary = "组织日志-获取用户列表") - @RequiresPermissions(PermissionConstants.ORGANIZATION_OPERATING_LOG_READ) + @RequiresPermissions(PermissionConstants.ORGANIZATION_LOG_READ) public List getLogUserList(@PathVariable(value = "organizationId") String organizationId) { return userService.getUserListByOrgId(organizationId); } @@ -69,7 +69,7 @@ public class OrganizationLogController { @PostMapping("/list") @Operation(summary = "组织菜单下操作日志列表查询") - @RequiresPermissions(PermissionConstants.ORGANIZATION_OPERATING_LOG_READ) + @RequiresPermissions(PermissionConstants.ORGANIZATION_LOG_READ) public Pager> organizationLogList(@Validated @RequestBody OperationLogRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc"); diff --git a/backend/services/system-setting/src/main/resources/permission.json b/backend/services/system-setting/src/main/resources/permission.json index ee3e9bbc67..02ba8981d8 100644 --- a/backend/services/system-setting/src/main/resources/permission.json +++ b/backend/services/system-setting/src/main/resources/permission.json @@ -138,11 +138,11 @@ ] }, { - "id": "SYSTEM_OPERATION_LOG", + "id": "SYSTEM_LOG", "name": "permission.system_operation_log.name", "permissions": [ { - "id": "SYSTEM_OPERATING_LOG:READ" + "id": "SYSTEM_LOG:READ" } ] } @@ -238,11 +238,11 @@ }, { - "id": "ORGANIZATION_OPERATION_LOG", + "id": "ORGANIZATION_LOG", "name": "permission.organization_operation_log.name", "permissions": [ { - "id": "ORGANIZATION_OPERATING_LOG:READ" + "id": "ORGANIZATION_LOG:READ" } ] } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OperationLogControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OperationLogControllerTests.java index 5f11ab17b5..eb115697a9 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OperationLogControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OperationLogControllerTests.java @@ -60,7 +60,7 @@ public class OperationLogControllerTests extends BaseTest { // @@异常参数校验 updatedGroupParamValidateTest(OperationLogRequestDefinition.class, OPERATION_LOG_LIST); // @@校验权限 - requestPostPermissionTest(PermissionConstants.SYSTEM_OPERATING_LOG_READ, OPERATION_LOG_LIST, request); + requestPostPermissionTest(PermissionConstants.SYSTEM_LOG_READ, OPERATION_LOG_LIST, request); } @@ -92,7 +92,7 @@ public class OperationLogControllerTests extends BaseTest { // @@异常参数校验 updatedGroupParamValidateTest(OperationLogRequestDefinition.class, OPERATION_LOG_LIST); // @@校验权限 - requestPostPermissionTest(PermissionConstants.SYSTEM_OPERATING_LOG_READ, OPERATION_LOG_LIST, request); + requestPostPermissionTest(PermissionConstants.SYSTEM_LOG_READ, OPERATION_LOG_LIST, request); } @@ -122,7 +122,7 @@ public class OperationLogControllerTests extends BaseTest { // @@异常参数校验 updatedGroupParamValidateTest(OperationLogRequestDefinition.class, OPERATION_LOG_LIST); // @@校验权限 - requestPostPermissionTest(PermissionConstants.SYSTEM_OPERATING_LOG_READ, OPERATION_LOG_LIST, request); + requestPostPermissionTest(PermissionConstants.SYSTEM_LOG_READ, OPERATION_LOG_LIST, request); } @@ -132,7 +132,7 @@ public class OperationLogControllerTests extends BaseTest { this.requestGetWithOkAndReturn(OPTIONS_LIST); // @@校验权限 - requestGetPermissionTest(PermissionConstants.SYSTEM_OPERATING_LOG_READ, OPTIONS_LIST); + requestGetPermissionTest(PermissionConstants.SYSTEM_LOG_READ, OPTIONS_LIST); } @Test @@ -141,7 +141,7 @@ public class OperationLogControllerTests extends BaseTest { this.requestGetWithOkAndReturn(USER_LIST); // @@校验权限 - requestGetPermissionTest(PermissionConstants.SYSTEM_OPERATING_LOG_READ, USER_LIST); + requestGetPermissionTest(PermissionConstants.SYSTEM_LOG_READ, USER_LIST); } @Test diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationLogControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationLogControllerTests.java index f9f2912754..17b0f38c70 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationLogControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationLogControllerTests.java @@ -69,7 +69,7 @@ public class OrganizationLogControllerTests extends BaseTest { // @@异常参数校验 updatedGroupParamValidateTest(OperationLogRequestDefinition.class, ORGANIZATION_LOG_LIST); - requestPostPermissionTest(PermissionConstants.ORGANIZATION_OPERATING_LOG_READ, ORGANIZATION_LOG_LIST, request); + requestPostPermissionTest(PermissionConstants.ORGANIZATION_LOG_READ, ORGANIZATION_LOG_LIST, request); }