diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java index d95c527f59..b5b9c136e7 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java @@ -57,10 +57,11 @@ public class OperationLogModule { public static final String SETTING = "SETTING"; public static final String SETTING_SYSTEM = "SETTING_SYSTEM"; - public static final String SETTING_SYSTEM_USER = "SETTING_SYSTEM_USER"; + public static final String SETTING_SYSTEM_USER_SINGLE = "SETTING_SYSTEM_USER"; public static final String SETTING_SYSTEM_USER_GROUP = "SETTING_SYSTEM_USER_GROUP"; public static final String SETTING_SYSTEM_ORGANIZATION = "SETTING_SYSTEM_ORGANIZATION"; public static final String SETTING_SYSTEM_PARAMETER = "SETTING_SYSTEM_PARAMETER"; + public static final String SETTING_SYSTEM_PARAMETER_BASE_CONFIG = "SETTING_SYSTEM_PARAMETER_BASE_CONFIG"; public static final String SETTING_SYSTEM_PARAMETER_PAGE_CONFIG = "SETTING_SYSTEM_PARAMETER_PAGE_CONFIG"; public static final String SETTING_SYSTEM_PARAMETER_AUTH_CONFIG = "SETTING_SYSTEM_PARAMETER_AUTH_CONFIG"; //系统设置-系统-资源池 diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/SystemParameterService.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/SystemParameterService.java index 5a669530e4..e1f1e3a518 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/SystemParameterService.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/service/SystemParameterService.java @@ -225,10 +225,10 @@ public class SystemParameterService { LogDTO dto = new LogDTO( OperationLogConstants.SYSTEM, OperationLogConstants.SYSTEM, - "system-parameter", + OperationLogConstants.SYSTEM, null, OperationLogType.ADD.name(), - OperationLogModule.SETTING_SYSTEM_PARAMETER, + OperationLogModule.SETTING_SYSTEM_PARAMETER_BASE_CONFIG, "基础设置"); dto.setPath("/system/parameter/save/base-info"); @@ -242,10 +242,10 @@ public class SystemParameterService { LogDTO dto = new LogDTO( OperationLogConstants.SYSTEM, OperationLogConstants.SYSTEM, - "system-parameter", + OperationLogConstants.SYSTEM, null, OperationLogType.ADD.name(), - OperationLogModule.SETTING_SYSTEM_PARAMETER, + OperationLogModule.SETTING_SYSTEM_PARAMETER_BASE_CONFIG, "基础设置"); dto.setPath("/system/parameter/edit/email-info"); 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 48df5c0cfd..fa4f655de3 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 @@ -62,7 +62,7 @@ public class OperationLogController { @PostMapping("/list") - @Operation(summary = "组织操作日志列表查询") + @Operation(summary = "系统操作日志列表查询") @RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ) public Pager> list(@Validated @RequestBody OperationLogRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), 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 1927761532..eacc12dd9a 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 @@ -9,6 +9,7 @@ import io.metersphere.sdk.log.vo.OperationLogRequest; import io.metersphere.sdk.log.vo.OperationLogResponse; import io.metersphere.sdk.util.PageUtils; import io.metersphere.sdk.util.Pager; +import io.metersphere.sdk.util.SessionUtils; import io.metersphere.system.domain.User; import io.metersphere.system.dto.OrganizationProjectOptionsDTO; import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse; @@ -17,11 +18,13 @@ import io.metersphere.system.service.UserService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.Arrays; import java.util.List; @@ -70,6 +73,10 @@ public class OrganizationLogController { public Pager> organizationLogList(@Validated @RequestBody OperationLogRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc"); + if (CollectionUtils.isEmpty(request.getOrganizationIds())) { + //未传组织id 获取登录用户当前组织id + request.setOrganizationIds(Arrays.asList(SessionUtils.getCurrentOrganizationId())); + } return PageUtils.setPageInfo(page, operationLogService.list(request)); } 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 e13d662984..f9f2912754 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 @@ -56,6 +56,7 @@ public class OrganizationLogControllerTests extends BaseTest { request.setType("add"); request.setModule("SYSTEM_PARAMETER_SETTING"); request.setContent("认证配置"); + request.setOrganizationIds(Arrays.asList("organization_id_001", "organization_id_002")); this.requestPostWithOkAndReturn(ORGANIZATION_LOG_LIST, request); //项目级别 指定项目查询