fix(操作日志): 修改系统参数操作日志相关问题

This commit is contained in:
fit2-zhao 2021-05-27 10:35:46 +08:00 committed by fit2-zhao
parent 96c9ead113
commit 6696d49caa
6 changed files with 31 additions and 3 deletions

View File

@ -5,14 +5,12 @@ import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.domain.UserHeader; import io.metersphere.base.domain.UserHeader;
import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.ParamConstants; import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.controller.request.HeaderRequest; import io.metersphere.controller.request.HeaderRequest;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.ldap.domain.LdapInfo; import io.metersphere.ldap.domain.LdapInfo;
import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.notice.domain.MailInfo; import io.metersphere.notice.domain.MailInfo;
import io.metersphere.service.SystemParameterService; import io.metersphere.service.SystemParameterService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -68,7 +66,7 @@ public class SystemParameterController {
} }
@PostMapping("/save/ldap") @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> systemParameter) { public void saveLdap(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.saveLdap(systemParameter); SystemParameterService.saveLdap(systemParameter);
} }

View File

@ -18,6 +18,7 @@ public class SystemReference {
public static Map<String, String> jarColumns = new LinkedHashMap<>(); public static Map<String, String> jarColumns = new LinkedHashMap<>();
public static Map<String, String> environmentColumns = new LinkedHashMap<>(); public static Map<String, String> environmentColumns = new LinkedHashMap<>();
public static Map<String, String> licenseColumns = new LinkedHashMap<>(); public static Map<String, String> licenseColumns = new LinkedHashMap<>();
public static Map<String, String> ldapColumns = new LinkedHashMap<>();
static { static {
@ -35,6 +36,7 @@ public class SystemReference {
jarColumns.clear(); jarColumns.clear();
environmentColumns.clear(); environmentColumns.clear();
licenseColumns.clear(); licenseColumns.clear();
ldapColumns.clear();
userColumns.put("name", "用户名称"); userColumns.put("name", "用户名称");
userColumns.put("createUser", "创建人"); userColumns.put("createUser", "创建人");
@ -117,5 +119,13 @@ public class SystemReference {
licenseColumns.put("licenseVersion", "授权数量"); licenseColumns.put("licenseVersion", "授权数量");
licenseColumns.put("status", "状态"); 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认证");
} }
} }

View File

@ -1,5 +1,6 @@
package io.metersphere.service; package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.api.service.ApiTestEnvironmentService; import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.SystemHeaderMapper; import io.metersphere.base.mapper.SystemHeaderMapper;
@ -14,6 +15,10 @@ import io.metersphere.controller.request.HeaderRequest;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.ldap.domain.LdapInfo; 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 io.metersphere.notice.domain.MailInfo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
@ -181,6 +186,8 @@ public class SystemParameterService {
} }
example.clear(); example.clear();
}); });
} }
public LdapInfo getLdapInfo(String type) { public LdapInfo getLdapInfo(String type) {
@ -290,4 +297,14 @@ public class SystemParameterService {
} }
return null; return null;
} }
public String getLogDetails() {
LdapInfo ldapInfo = this.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
if (ldapInfo != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(ldapInfo, SystemReference.ldapColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ldapInfo.getUrl()), null, "LDAP设置", null, columns);
return JSON.toJSONString(details);
}
return null;
}
} }

View File

@ -1832,5 +1832,6 @@ export default {
after_change: "After change", after_change: "After change",
share: "Share", share: "Share",
change_history: "Change history", change_history: "Change history",
change_content: "Change content"
} }
}; };

View File

@ -1839,5 +1839,6 @@ export default {
after_change: "变更后", after_change: "变更后",
share: "分享", share: "分享",
change_history: "变更历史", change_history: "变更历史",
change_content: "变更内容"
} }
}; };

View File

@ -1839,5 +1839,6 @@ export default {
after_change: "變更後", after_change: "變更後",
share: "分享", share: "分享",
change_history: "變更歷史", change_history: "變更歷史",
change_content: "變更内容"
} }
}; };