diff --git a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java index 952d8dcd33..b941b739d2 100644 --- a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java +++ b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java @@ -5,14 +5,12 @@ import io.metersphere.base.domain.SystemParameter; import io.metersphere.base.domain.UserHeader; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.ParamConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.controller.request.HeaderRequest; import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.ldap.domain.LdapInfo; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.notice.domain.MailInfo; import io.metersphere.service.SystemParameterService; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -68,7 +66,7 @@ public class SystemParameterController { } @PostMapping("/save/ldap") - @MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "LDAP设置") + @MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails()", content = "#msClass.getLogDetails()", msClass = SystemParameterService.class) public void saveLdap(@RequestBody List systemParameter) { SystemParameterService.saveLdap(systemParameter); } diff --git a/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java b/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java index 799679e1cb..1cc04912e2 100644 --- a/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java +++ b/backend/src/main/java/io/metersphere/log/vo/system/SystemReference.java @@ -18,6 +18,7 @@ public class SystemReference { public static Map jarColumns = new LinkedHashMap<>(); public static Map environmentColumns = new LinkedHashMap<>(); public static Map licenseColumns = new LinkedHashMap<>(); + public static Map ldapColumns = new LinkedHashMap<>(); static { @@ -35,6 +36,7 @@ public class SystemReference { jarColumns.clear(); environmentColumns.clear(); licenseColumns.clear(); + ldapColumns.clear(); userColumns.put("name", "用户名称"); userColumns.put("createUser", "创建人"); @@ -117,5 +119,13 @@ public class SystemReference { licenseColumns.put("licenseVersion", "授权数量"); licenseColumns.put("status", "状态"); + ldapColumns.put("url", "LDAP地址"); + ldapColumns.put("dn", "绑定DN"); + ldapColumns.put("password", "密码"); + ldapColumns.put("ou", "用户OU"); + ldapColumns.put("filter", "用户过滤器"); + ldapColumns.put("mapping", "LDAP属性映射"); + ldapColumns.put("open", "启用LDAP认证"); + } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/service/SystemParameterService.java b/backend/src/main/java/io/metersphere/service/SystemParameterService.java index bd9b7aef5a..9305e4fd30 100644 --- a/backend/src/main/java/io/metersphere/service/SystemParameterService.java +++ b/backend/src/main/java/io/metersphere/service/SystemParameterService.java @@ -1,5 +1,6 @@ package io.metersphere.service; +import com.alibaba.fastjson.JSON; import io.metersphere.api.service.ApiTestEnvironmentService; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.SystemHeaderMapper; @@ -14,6 +15,10 @@ import io.metersphere.controller.request.HeaderRequest; import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.i18n.Translator; import io.metersphere.ldap.domain.LdapInfo; +import io.metersphere.log.utils.ReflexObjectUtil; +import io.metersphere.log.vo.DetailColumn; +import io.metersphere.log.vo.OperatingLogDetails; +import io.metersphere.log.vo.system.SystemReference; import io.metersphere.notice.domain.MailInfo; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; @@ -181,6 +186,8 @@ public class SystemParameterService { } example.clear(); }); + + } public LdapInfo getLdapInfo(String type) { @@ -290,4 +297,14 @@ public class SystemParameterService { } return null; } + + public String getLogDetails() { + LdapInfo ldapInfo = this.getLdapInfo(ParamConstants.Classify.LDAP.getValue()); + if (ldapInfo != null) { + List columns = ReflexObjectUtil.getColumns(ldapInfo, SystemReference.ldapColumns); + OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ldapInfo.getUrl()), null, "LDAP设置", null, columns); + return JSON.toJSONString(details); + } + return null; + } } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index fffba6963f..fd1f01bb8b 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1832,5 +1832,6 @@ export default { after_change: "After change", share: "Share", change_history: "Change history", + change_content: "Change content" } }; diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index a537915318..44ddb87e67 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1839,5 +1839,6 @@ export default { after_change: "变更后", share: "分享", change_history: "变更历史", + change_content: "变更内容" } }; diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 4194767c61..40913c195f 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1839,5 +1839,6 @@ export default { after_change: "變更後", share: "分享", change_history: "變更歷史", + change_content: "變更内容" } };