Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
10
README.md
10
README.md
@@ -72,11 +72,11 @@ docker compose up -d
|
||||
|
||||
## 项目文档
|
||||
|
||||
* [文档地址](https://lijiahangmax.github.io/open-orion/orion-visor/)
|
||||
* [安装文档](https://lijiahangmax.github.io/open-orion/orion-visor/quickstart/docker.html)
|
||||
* [更新日志](https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html)
|
||||
* [操作手册](https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html)
|
||||
* [常见问题](https://lijiahangmax.github.io/open-orion/orion-visor/support/faq.html)
|
||||
* [文档地址](https://visor.orionsec.cn/)
|
||||
* [安装文档](https://visor.orionsec.cn/quickstart/docker.html)
|
||||
* [更新日志](https://visor.orionsec.cn/update/change-log.html)
|
||||
* [操作手册](https://visor.orionsec.cn/operator/asset.html)
|
||||
* [常见问题](https://visor.orionsec.cn/support/faq.html)
|
||||
|
||||
## 技术栈
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ items:
|
||||
code: 200
|
||||
- name: userPermission
|
||||
request:
|
||||
api: /orion-visor/api/infra/permission/user
|
||||
api: /orion-visor/api/infra/user-permission/user
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
expect:
|
||||
@@ -26,7 +26,7 @@ items:
|
||||
msg: "success"
|
||||
- name: menu
|
||||
request:
|
||||
api: /orion-visor/api/infra/permission/menu
|
||||
api: /orion-visor/api/infra/user-permission/menu
|
||||
header:
|
||||
Authorization: Bearer {{.login.data.token}}
|
||||
expect:
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.orion.lang.define.wrapper.IPageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
/**
|
||||
* 公共页码请求
|
||||
@@ -17,11 +19,13 @@ import org.hibernate.validator.constraints.Range;
|
||||
@Schema(description = "公共页码请求")
|
||||
public class PageRequest implements IPageRequest {
|
||||
|
||||
@Range(min = 1, max = 10000, groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 10000, groups = Page.class)
|
||||
@Schema(description = "页码")
|
||||
private int page;
|
||||
|
||||
@Range(min = 1, max = 200, groups = Page.class)
|
||||
@Min(value = 1, groups = Page.class)
|
||||
@Max(value = 200, groups = Page.class)
|
||||
@Schema(description = "大小")
|
||||
private int limit;
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.orion.visor.framework.common.utils;
|
||||
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
|
||||
/**
|
||||
* sql 工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/8/26 16:03
|
||||
*/
|
||||
public class SqlUtils {
|
||||
|
||||
private SqlUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* limit n
|
||||
*
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(Integer limit) {
|
||||
return Const.LIMIT + Const.SPACE + limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* limit offset limit
|
||||
*
|
||||
* @param offset offset
|
||||
* @param limit limit
|
||||
* @return limit
|
||||
*/
|
||||
public static String limit(int offset, Integer limit) {
|
||||
return Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 批量验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Batch extends Default {
|
||||
public interface Batch {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 清理验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Clear {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Export {
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Id extends Default {
|
||||
public interface Id {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Import {
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.framework.common.validator.group;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
*
|
||||
@@ -9,5 +7,5 @@ import javax.validation.groups.Default;
|
||||
* @version 1.0.0
|
||||
* @since 2023/9/1 19:13
|
||||
*/
|
||||
public interface Page extends Default {
|
||||
public interface Page {
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.reflect.Classes;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.mybatis.core.domain.BaseDO;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -111,11 +112,11 @@ public class DataQuery<T> {
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int limit) {
|
||||
return this.last(Const.LIMIT + Const.SPACE + limit);
|
||||
return this.last(SqlUtils.limit(limit));
|
||||
}
|
||||
|
||||
public DataQuery<T> limit(int offset, int limit) {
|
||||
return this.last(Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit);
|
||||
return this.last(SqlUtils.limit(offset, limit));
|
||||
}
|
||||
|
||||
public DataQuery<T> only() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.HostGroupOperatorType;
|
||||
import com.orion.visor.module.asset.define.operator.HostIdentityOperatorType;
|
||||
@@ -43,6 +44,7 @@ public class AssetDataGrantServiceController {
|
||||
@Resource
|
||||
private AssetAuthorizedDataService assetAuthorizedDataService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostGroupOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-group")
|
||||
@Operation(summary = "主机分组授权")
|
||||
@@ -60,6 +62,7 @@ public class AssetDataGrantServiceController {
|
||||
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_GROUP, request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostKeyOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-key")
|
||||
@Operation(summary = "主机密钥授权")
|
||||
@@ -77,6 +80,7 @@ public class AssetDataGrantServiceController {
|
||||
return assetAuthorizedDataService.getAuthorizedDataRelId(DataPermissionTypeEnum.HOST_KEY, request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostIdentityOperatorType.GRANT)
|
||||
@PutMapping("/grant-host-identity")
|
||||
@Operation(summary = "主机身份授权")
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
@@ -136,7 +137,7 @@ public class ExecCommandLogController {
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空批量执行日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:management:clear')")
|
||||
public Integer clearExecCommandLog(@RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecCommandLog(@Validated(Clear.class) @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
@@ -178,4 +179,3 @@ public class ExecCommandLogController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.orion.visor.module.asset.controller;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
@@ -125,7 +126,7 @@ public class ExecJobLogController {
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空计划任务日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:management:clear')")
|
||||
public Integer clearExecJobLog(@RequestBody ExecLogQueryRequest request) {
|
||||
public Integer clearExecJobLog(@Validated(Clear.class) @RequestBody ExecLogQueryRequest request) {
|
||||
request.setSource(SOURCE);
|
||||
return execLogService.clearExecLog(request);
|
||||
}
|
||||
@@ -167,4 +168,3 @@ public class ExecJobLogController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.DemoDisableApi;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.define.operator.ExecTemplateOperatorType;
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecTemplateCreateRequest;
|
||||
@@ -41,6 +42,7 @@ public class ExecTemplateController {
|
||||
@Resource
|
||||
private ExecTemplateService execTemplateService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建执行模板")
|
||||
@@ -49,6 +51,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.createExecTemplate(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新执行模板")
|
||||
@@ -83,6 +86,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.getExecTemplatePage(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除执行模板")
|
||||
@@ -92,6 +96,7 @@ public class ExecTemplateController {
|
||||
return execTemplateService.deleteExecTemplateById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除执行模板")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Id;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
@@ -84,7 +85,7 @@ public class HostConnectLogController {
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空主机连接日志")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-connect-log:management:clear')")
|
||||
public Integer clearHostConnectLog(@RequestBody HostConnectLogQueryRequest request) {
|
||||
public Integer clearHostConnectLog(@Validated(Clear.class) @RequestBody HostConnectLogQueryRequest request) {
|
||||
return hostConnectLogService.clearHostConnectLog(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
@@ -123,7 +124,7 @@ public class UploadTaskController {
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空上传任务")
|
||||
@PreAuthorize("@ss.hasPermission('asset:upload-task:management:clear')")
|
||||
public Integer clearUploadTask(@RequestBody UploadTaskQueryRequest request) {
|
||||
public Integer clearUploadTask(@Validated(Clear.class) @RequestBody UploadTaskQueryRequest request) {
|
||||
return uploadTaskService.clearUploadTask(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.orion.visor.module.asset.entity.request.exec;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -62,4 +67,16 @@ public class ExecLogQueryRequest extends PageRequest {
|
||||
@Schema(description = "状态")
|
||||
private List<String> statusList;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 1000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package com.orion.visor.module.asset.entity.request.host;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Id;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -24,6 +30,7 @@ import java.util.List;
|
||||
@Schema(name = "HostConnectLogQueryRequest", description = "主机连接日志 查询请求对象")
|
||||
public class HostConnectLogQueryRequest extends PageRequest {
|
||||
|
||||
@NotNull(groups = Id.class)
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@@ -63,4 +70,16 @@ public class HostConnectLogQueryRequest extends PageRequest {
|
||||
@Schema(description = "状态")
|
||||
private List<String> statusList;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 2000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
@@ -45,7 +46,8 @@ public class HostCreateRequest implements Serializable {
|
||||
@Schema(description = "主机地址")
|
||||
private String address;
|
||||
|
||||
@Range(min = 1, max = 65535)
|
||||
@Min(value = 1)
|
||||
@Max(value = 65535)
|
||||
@Schema(description = "主机端口")
|
||||
private Integer port;
|
||||
|
||||
|
||||
@@ -5,11 +5,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,7 +43,9 @@ public class HostUpdateRequest implements Serializable {
|
||||
@Schema(description = "主机地址")
|
||||
private String address;
|
||||
|
||||
@Range(min = 1, max = 65535)
|
||||
@NotNull
|
||||
@Min(value = 1)
|
||||
@Max(value = 65535)
|
||||
@Schema(description = "主机端口")
|
||||
private Integer port;
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.orion.visor.module.asset.entity.request.upload;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -44,4 +49,16 @@ public class UploadTaskQueryRequest extends PageRequest {
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date[] createTimeRange;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 2000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 主机 SSH 配置
|
||||
@@ -64,7 +61,8 @@ public class HostSshConfigModel implements GenericsDataModel, UpdatePasswordActi
|
||||
* 连接超时时间
|
||||
*/
|
||||
@NotNull
|
||||
@Range(min = 0, max = 100000)
|
||||
@Min(value = 1)
|
||||
@Max(value = 100000)
|
||||
private Integer connectTimeout;
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.constant.FileConst;
|
||||
import com.orion.visor.framework.common.enums.EndpointDefine;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisStrings;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
@@ -227,7 +228,8 @@ public class ExecLogServiceImpl implements ExecLogService {
|
||||
log.info("ExecLogService.clearExecLog start {}", JSON.toJSONString(request));
|
||||
// 查询
|
||||
LambdaQueryWrapper<ExecLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.select(ExecLogDO::getId);
|
||||
.select(ExecLogDO::getId)
|
||||
.last(SqlUtils.limit(request.getClearLimit()));
|
||||
List<Long> idList = execLogDAO.selectList(wrapper)
|
||||
.stream()
|
||||
.map(ExecLogDO::getId)
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
import com.orion.visor.module.asset.convert.HostConnectLogConvert;
|
||||
@@ -26,6 +27,7 @@ import com.orion.visor.module.asset.service.HostConnectLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
@@ -167,13 +169,14 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteHostConnectLog(List<Long> idList) {
|
||||
log.info("HostConnectLogService.deleteHostConnectLog start {}", JSON.toJSONString(idList));
|
||||
if (Lists.isEmpty(idList)) {
|
||||
OperatorLogs.add(OperatorLogs.COUNT, Const.N_0);
|
||||
return Const.N_0;
|
||||
}
|
||||
// 删除
|
||||
// 删除日志表
|
||||
int effect = hostConnectLogDAO.deleteBatchIds(idList);
|
||||
log.info("HostConnectLogService.deleteHostConnectLog finish {}", effect);
|
||||
// 设置日志参数
|
||||
@@ -187,11 +190,13 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer clearHostConnectLog(HostConnectLogQueryRequest request) {
|
||||
log.info("HostConnectLogService.clearHostConnectLog start {}", JSON.toJSONString(request));
|
||||
// 查询
|
||||
LambdaQueryWrapper<HostConnectLogDO> wrapper = this.buildQueryWrapper(request)
|
||||
.select(HostConnectLogDO::getId);
|
||||
.select(HostConnectLogDO::getId)
|
||||
.last(SqlUtils.limit(request.getClearLimit()));
|
||||
List<HostConnectLogDO> list = hostConnectLogDAO.selectList(wrapper);
|
||||
if (list.isEmpty()) {
|
||||
log.info("HostConnectLogService.clearHostConnectLog empty");
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.enums.EndpointDefine;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.common.security.LoginUser;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.mybatis.core.query.Conditions;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
@@ -226,7 +227,8 @@ public class UploadTaskServiceImpl implements UploadTaskService {
|
||||
public Integer clearUploadTask(UploadTaskQueryRequest request) {
|
||||
// 查询id
|
||||
LambdaQueryWrapper<UploadTaskDO> wrapper = this.buildQueryWrapper(request)
|
||||
.select(UploadTaskDO::getId);
|
||||
.select(UploadTaskDO::getId)
|
||||
.last(SqlUtils.limit(request.getClearLimit()));
|
||||
List<Long> idList = uploadTaskDAO.of(wrapper)
|
||||
.list(UploadTaskDO::getId);
|
||||
// 删除
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orion.visor.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import com.orion.visor.framework.common.validator.group.Page;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
@@ -67,7 +68,7 @@ public class OperatorLogController {
|
||||
@PostMapping("/clear")
|
||||
@Operation(summary = "清空操作日志")
|
||||
@PreAuthorize("@ss.hasPermission('infra:operator-log:management:clear')")
|
||||
public Integer clearOperatorLog(@RequestBody OperatorLogQueryRequest request) {
|
||||
public Integer clearOperatorLog(@Validated(Clear.class) @RequestBody OperatorLogQueryRequest request) {
|
||||
return operatorLogService.clearOperatorLog(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class SystemRoleController {
|
||||
@Resource
|
||||
private SystemRoleMenuService systemRoleMenuService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemRoleOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建角色")
|
||||
@@ -56,6 +57,7 @@ public class SystemRoleController {
|
||||
return systemRoleService.createSystemRole(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemRoleOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新角色")
|
||||
@@ -116,6 +118,7 @@ public class SystemRoleController {
|
||||
return systemRoleService.deleteSystemRoleById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemRoleOperatorType.GRANT_MENU)
|
||||
@PutMapping("/grant-menu")
|
||||
@Operation(summary = "分配角色菜单")
|
||||
|
||||
@@ -55,6 +55,7 @@ public class SystemUserController {
|
||||
@Resource
|
||||
private OperatorLogService operatorLogService;
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemUserOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户")
|
||||
@@ -63,6 +64,7 @@ public class SystemUserController {
|
||||
return systemUserService.createSystemUser(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemUserOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新用户")
|
||||
@@ -82,6 +84,7 @@ public class SystemUserController {
|
||||
return systemUserService.updateUserStatus(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemUserOperatorType.GRANT_ROLE)
|
||||
@PutMapping("/grant-role")
|
||||
@Operation(summary = "分配用户角色")
|
||||
|
||||
@@ -5,8 +5,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
@@ -30,7 +31,8 @@ public class CronNextRequest implements Serializable {
|
||||
private String expression;
|
||||
|
||||
@NotNull
|
||||
@Range(min = 1, max = 100)
|
||||
@Min(value = 1)
|
||||
@Max(value = 100)
|
||||
@Schema(description = "次数")
|
||||
private Integer times;
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.orion.visor.module.infra.entity.request.operator;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.entity.PageRequest;
|
||||
import com.orion.visor.framework.common.validator.group.Clear;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -48,4 +53,16 @@ public class OperatorLogQueryRequest extends PageRequest {
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date[] startTimeRange;
|
||||
|
||||
@NotNull(groups = Clear.class)
|
||||
@Min(value = 1, groups = Clear.class)
|
||||
@Max(value = 2000, groups = Clear.class)
|
||||
@Schema(description = "清理数量限制")
|
||||
private Integer clearLimit;
|
||||
|
||||
public void setClearLimit(Integer clearLimit) {
|
||||
this.clearLimit = clearLimit;
|
||||
this.setPage(Const.N_1);
|
||||
this.setLimit(clearLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.orion.lang.utils.Valid;
|
||||
import com.orion.visor.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.SqlUtils;
|
||||
import com.orion.visor.module.infra.convert.OperatorLogConvert;
|
||||
import com.orion.visor.module.infra.dao.OperatorLogDAO;
|
||||
import com.orion.visor.module.infra.define.operator.AuthenticationOperatorType;
|
||||
@@ -72,8 +73,10 @@ public class OperatorLogServiceImpl implements OperatorLogService {
|
||||
@Override
|
||||
public Integer clearOperatorLog(OperatorLogQueryRequest request) {
|
||||
log.info("OperatorLogService.clearOperatorLog start {}", JSON.toJSONString(request));
|
||||
// 删除
|
||||
// 删除参数
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request);
|
||||
wrapper.last(SqlUtils.limit(request.getClearLimit()));
|
||||
// 删除
|
||||
int effect = operatorLogDAO.delete(wrapper);
|
||||
log.info("OperatorLogService.clearOperatorLog finish {}", effect);
|
||||
// 设置日志参数
|
||||
|
||||
@@ -45,12 +45,6 @@ public class TagRelServiceImpl implements TagRelService {
|
||||
|
||||
@Override
|
||||
public void addTagRel(String type, Long relId, List<Long> tagIdList) {
|
||||
// 删除引用
|
||||
TagRelQueryRequest deleteRequest = new TagRelQueryRequest();
|
||||
deleteRequest.setTagType(type);
|
||||
deleteRequest.setRelId(relId);
|
||||
LambdaQueryWrapper<TagRelDO> deleteWrapper = this.buildQueryWrapper(deleteRequest);
|
||||
tagRelDAO.delete(deleteWrapper);
|
||||
// 查询 tag
|
||||
List<TagDO> tagList = tagDAO.selectBatchIds(tagIdList);
|
||||
// 插入引用
|
||||
@@ -63,9 +57,6 @@ public class TagRelServiceImpl implements TagRelService {
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
tagRelDAO.insertBatch(tagRelList);
|
||||
// 设置缓存
|
||||
String cacheKey = TagCacheKeyDefine.TAG_REL.format(type, relId);
|
||||
RedisStrings.setJson(cacheKey, TagCacheKeyDefine.TAG_REL, TagRelConvert.MAPPER.toCacheList(tagRelList));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface HostConnectLogQueryRequest extends Pagination {
|
||||
token?: string;
|
||||
status?: string;
|
||||
startTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface ExecLogQueryRequest extends Pagination {
|
||||
command?: string;
|
||||
status?: string;
|
||||
startTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,6 +40,7 @@ export interface UploadTaskQueryRequest extends Pagination {
|
||||
description?: string;
|
||||
status?: string;
|
||||
createTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,7 @@ export function getSystemAppInfo() {
|
||||
* 获取仓库最后版本信息
|
||||
*/
|
||||
export function getRepoLatestRelease() {
|
||||
// return axios.get<RepoReleaseResponse>('https://gitee.com/api/v5/repos/dromara/orion-visor/releases/latest', {
|
||||
return axios.get<RepoReleaseResponse>('https://lijiahangmax.github.io/open-orion/orion-visor/releases-latest.json', {
|
||||
return axios.get<RepoReleaseResponse>('https://visor.orionsec.cn/releases-latest.json', {
|
||||
// 不添加请求头 否则会报 401
|
||||
setAuthorization: false,
|
||||
// 返回原始输出
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface OperatorLogQueryRequest extends Pagination {
|
||||
riskLevel?: string;
|
||||
result?: number;
|
||||
startTimeRange?: string[];
|
||||
clearLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<a-space size="large">
|
||||
<a-link target="_blank" href="https://github.com/dromara/orion-visor">github</a-link>
|
||||
<a-link target="_blank" href="https://gitee.com/dromara/orion-visor">gitee</a-link>
|
||||
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor">文档</a-link>
|
||||
<a-link target="_blank" href="https://visor.orionsec.cn">文档</a-link>
|
||||
<a-link target="_blank" href="https://github.com/dromara/orion-visor/blob/main/LICENSE">License</a-link>
|
||||
<a-link target="_blank" :href="`https://github.com/dromara/orion-visor/releases/tag/v${version}`">v{{ version }} {{ release }}</a-link>
|
||||
</a-space>
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
// 下载计划任务日志
|
||||
fileGetter = downloadExecJobLogFile(id);
|
||||
}
|
||||
// 瞎子啊
|
||||
// 下载
|
||||
const data = await fileGetter;
|
||||
downloadFile(data);
|
||||
};
|
||||
|
||||
6
orion-visor-ui/src/directive/focus/index.ts
Normal file
6
orion-visor-ui/src/directive/focus/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
mounted(el: HTMLElement) {
|
||||
// 聚焦元素
|
||||
el.focus();
|
||||
},
|
||||
};
|
||||
@@ -1,8 +1,10 @@
|
||||
import type { App } from 'vue';
|
||||
import permission from './permission';
|
||||
import focus from './focus';
|
||||
|
||||
export default {
|
||||
install(Vue: App) {
|
||||
Vue.directive('permission', permission);
|
||||
Vue.directive('focus', focus);
|
||||
},
|
||||
};
|
||||
|
||||
57
orion-visor-ui/src/store/modules/cache/index.ts
vendored
57
orion-visor-ui/src/store/modules/cache/index.ts
vendored
@@ -6,6 +6,7 @@ import type { HostType } from '@/api/asset/host';
|
||||
import { getHostList } from '@/api/asset/host';
|
||||
import type { PreferenceType } from '@/api/user/preference';
|
||||
import { getPreference } from '@/api/user/preference';
|
||||
import usePermission from '@/hooks/permission';
|
||||
import { defineStore } from 'pinia';
|
||||
import { getUserList } from '@/api/user/user';
|
||||
import { getRoleList } from '@/api/user/role';
|
||||
@@ -43,7 +44,25 @@ export default defineStore('cache', {
|
||||
},
|
||||
|
||||
// 加载数据
|
||||
async load<T>(name: CacheType, loader: () => Promise<AxiosResponse<T>>, force = false, onErrorValue = []) {
|
||||
async load<T>(name: CacheType,
|
||||
loader: () => Promise<AxiosResponse<T>>,
|
||||
permissions: Array<string> | undefined = undefined,
|
||||
force = false,
|
||||
onErrorValue: any = []) {
|
||||
// 权限检查
|
||||
const len = permissions?.length;
|
||||
if (len) {
|
||||
const { hasPermission, hasAnyPermission } = usePermission();
|
||||
if (len === 1) {
|
||||
if (!hasPermission(permissions[0])) {
|
||||
return onErrorValue as T;
|
||||
}
|
||||
} else {
|
||||
if (!hasAnyPermission(permissions)) {
|
||||
return onErrorValue as T;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 尝试直接从缓存中获取数据
|
||||
if (this[name] && !force) {
|
||||
return this[name] as T;
|
||||
@@ -60,92 +79,92 @@ export default defineStore('cache', {
|
||||
|
||||
// 获取用户列表
|
||||
async loadUsers(force = false) {
|
||||
return await this.load('users', getUserList, force);
|
||||
return await this.load('users', getUserList, ['infra:system-user:query'], force);
|
||||
},
|
||||
|
||||
// 获取角色列表
|
||||
async loadRoles(force = false) {
|
||||
return await this.load('roles', getRoleList, force);
|
||||
return await this.load('roles', getRoleList, ['infra:system-role:query'], force);
|
||||
},
|
||||
|
||||
// 获取菜单列表
|
||||
async loadMenus(force = false) {
|
||||
return await this.load('menus', () => getMenuList({}), force);
|
||||
return await this.load('menus', () => getMenuList({}), ['infra:system-menu:query'], force);
|
||||
},
|
||||
|
||||
// 获取主机分组列表
|
||||
async loadHostGroups(force = false) {
|
||||
return await this.load('hostGroups', getHostGroupTree, force);
|
||||
return await this.load('hostGroups', getHostGroupTree, ['asset:host-group:update'], force);
|
||||
},
|
||||
|
||||
// 获取主机列表
|
||||
async loadHosts(type: HostType, force = false) {
|
||||
return await this.load(`host_${type}`, () => getHostList(type), force);
|
||||
return await this.load(`host_${type}`, () => getHostList(type), ['asset:host:query'], force);
|
||||
},
|
||||
|
||||
// 获取主机密钥列表
|
||||
async loadHostKeys(force = false) {
|
||||
return await this.load('hostKeys', getHostKeyList, force);
|
||||
return await this.load('hostKeys', getHostKeyList, ['asset:host-key:query'], force);
|
||||
},
|
||||
|
||||
// 获取主机身份列表
|
||||
async loadHostIdentities(force = false) {
|
||||
return await this.load('hostIdentities', getHostIdentityList, force);
|
||||
return await this.load('hostIdentities', getHostIdentityList, ['asset:host-identity:query'], force);
|
||||
},
|
||||
|
||||
// 获取字典配置项列表
|
||||
async loadDictKeys(force = false) {
|
||||
return await this.load('dictKeys', getDictKeyList, force);
|
||||
return await this.load('dictKeys', getDictKeyList, undefined, force);
|
||||
},
|
||||
|
||||
// 加载 tags
|
||||
async loadTags(type: TagType, force = false) {
|
||||
return await this.load(`${type}_Tags`, () => getTagList(type), force);
|
||||
return await this.load(`${type}_Tags`, () => getTagList(type), undefined, force);
|
||||
},
|
||||
|
||||
// 获取已授权的主机密钥列表
|
||||
async loadAuthorizedHostKeys(force = false) {
|
||||
return await this.load('authorizedHostKeys', getCurrentAuthorizedHostKey, force);
|
||||
return await this.load('authorizedHostKeys', getCurrentAuthorizedHostKey, undefined, force);
|
||||
},
|
||||
|
||||
// 获取已授权的主机身份列表
|
||||
async loadAuthorizedHostIdentities(force = false) {
|
||||
return await this.load('authorizedHostIdentities', getCurrentAuthorizedHostIdentity, force);
|
||||
return await this.load('authorizedHostIdentities', getCurrentAuthorizedHostIdentity, undefined, force);
|
||||
},
|
||||
|
||||
// 获取命令片段分组
|
||||
async loadCommandSnippetGroups(force = false) {
|
||||
return await this.load('commandSnippetGroups', getCommandSnippetGroupList, force);
|
||||
return await this.load('commandSnippetGroups', getCommandSnippetGroupList, undefined, force);
|
||||
},
|
||||
|
||||
// 获取路径书签分组
|
||||
async loadPathBookmarkGroups(force = false) {
|
||||
return await this.load('pathBookmarkGroups', getPathBookmarkGroupList, force);
|
||||
return await this.load('pathBookmarkGroups', getPathBookmarkGroupList, undefined, force);
|
||||
},
|
||||
|
||||
// 获取命令片段列表
|
||||
async loadCommandSnippets(force = false) {
|
||||
return await this.load('commandSnippets', getCommandSnippetList, force);
|
||||
return await this.load('commandSnippets', getCommandSnippetList, undefined, force, {});
|
||||
},
|
||||
|
||||
// 获取路径书签列表
|
||||
async loadPathBookmarks(force = false) {
|
||||
return await this.load('pathBookmarks', getPathBookmarkList, force);
|
||||
return await this.load('pathBookmarks', getPathBookmarkList, undefined, force, {});
|
||||
},
|
||||
|
||||
// 获取执行计划列表
|
||||
async loadExecJobs(force = false) {
|
||||
return await this.load('execJob', getExecJobList, force);
|
||||
return await this.load('execJob', getExecJobList, ['asset:exec-job:query'], force);
|
||||
},
|
||||
|
||||
// 加载偏好
|
||||
async loadPreference<T>(type: PreferenceType, force = false) {
|
||||
return await this.load(`preference_${type}`, () => getPreference<T>(type), force);
|
||||
return await this.load(`preference_${type}`, () => getPreference<T>(type), undefined, force, {});
|
||||
},
|
||||
|
||||
// 加载偏好项
|
||||
async loadPreferenceItem<T>(type: PreferenceType, item: string, force = false) {
|
||||
return await this.load(`preference_${type}_${item}`, () => getPreference<T>(type, [item]), force);
|
||||
return await this.load(`preference_${type}_${item}`, () => getPreference<T>(type, [item]), undefined, force, {});
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
@@ -55,6 +55,15 @@
|
||||
:options="toOptions(connectTypeKey)"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
@@ -71,7 +80,7 @@
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { connectStatusKey, connectTypeKey } from '../types/const';
|
||||
import { connectStatusKey, connectTypeKey, clearLimit } from '../types/const';
|
||||
import { getHostConnectLogCount, clearHostConnectLog } from '@/api/asset/host-connect-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
@@ -92,6 +101,7 @@
|
||||
type: undefined,
|
||||
status: undefined,
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -112,6 +122,10 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
// 获取总数量
|
||||
@@ -134,7 +148,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -12,6 +12,9 @@ export const HostConnectStatus = {
|
||||
FORCE_OFFLINE: 'FORCE_OFFLINE',
|
||||
};
|
||||
|
||||
// 清理数量
|
||||
export const clearLimit = 2000;
|
||||
|
||||
// 主机连接状态 字典项
|
||||
export const connectStatusKey = 'hostConnectStatus';
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
<a-link target="_blank" href="https://github.com/dromara/orion-visor/issues">上报 bug</a-link>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html">操作手册</a-link>
|
||||
<a-link target="_blank" href="https://visor.orionsec.cn/operator/asset.html">操作手册</a-link>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html">更新日志</a-link>
|
||||
<a-link target="_blank" href="https://visor.orionsec.cn/update/change-log.html">更新日志</a-link>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
@@ -48,6 +48,15 @@
|
||||
:options="toOptions(execStatusKey)"
|
||||
placeholder="请选择执行状态" />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
@@ -68,6 +77,7 @@
|
||||
import { getExecCommandLogCount, clearExecCommandLog } from '@/api/exec/exec-command-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { clearLimit } from '../types/const';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
|
||||
const emits = defineEmits(['clear']);
|
||||
@@ -86,7 +96,8 @@
|
||||
description: undefined,
|
||||
command: undefined,
|
||||
status: undefined,
|
||||
startTimeRange: undefined
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -105,6 +116,10 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
// 获取总数量
|
||||
@@ -127,7 +142,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// 清理数量
|
||||
export const clearLimit = 1000;
|
||||
|
||||
@@ -49,6 +49,15 @@
|
||||
placeholder="请选择状态"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
@@ -65,7 +74,7 @@
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { uploadTaskStatusKey } from '../types/const';
|
||||
import { clearLimit, uploadTaskStatusKey } from '../types/const';
|
||||
import { getUploadTaskCount, clearUploadTask } from '@/api/exec/upload-task';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
@@ -105,6 +114,10 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
// 获取总数量
|
||||
@@ -127,7 +140,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -26,6 +26,9 @@ export const UploadTaskFileStatus = {
|
||||
CANCELED: 'CANCELED',
|
||||
};
|
||||
|
||||
// 清理数量
|
||||
export const clearLimit = 2000;
|
||||
|
||||
// 上传任务状态 字典项
|
||||
export const uploadTaskStatusKey = 'uploadTaskStatus';
|
||||
|
||||
|
||||
@@ -43,6 +43,15 @@
|
||||
:options="toOptions(execStatusKey)"
|
||||
placeholder="请选择执行状态" />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
@@ -63,6 +72,7 @@
|
||||
import { getExecJobLogCount, clearExecJobLog } from '@/api/job/exec-job-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { clearLimit } from '../types/const';
|
||||
import ExecJobSelector from '@/components/exec/job/selector/index.vue';
|
||||
|
||||
const emits = defineEmits(['clear']);
|
||||
@@ -81,7 +91,8 @@
|
||||
description: undefined,
|
||||
command: undefined,
|
||||
status: undefined,
|
||||
startTimeRange: undefined
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -100,6 +111,10 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
// 获取总数量
|
||||
@@ -122,7 +137,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// 清理数量
|
||||
export const clearLimit = 1000;
|
||||
|
||||
@@ -61,6 +61,15 @@
|
||||
placeholder="请选择执行结果"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 清理数量 -->
|
||||
<a-form-item field="clearLimit" label="清理数量">
|
||||
<a-input-number v-model="formModel.clearLimit"
|
||||
:min="1"
|
||||
:max="clearLimit"
|
||||
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
|
||||
hide-button
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
@@ -81,7 +90,7 @@
|
||||
import { getOperatorLogCount, clearOperatorLog } from '@/api/user/operator-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { operatorLogModuleKey, operatorLogResultKey, operatorLogTypeKey, operatorRiskLevelKey } from '@/views/user/operator-log/types/const';
|
||||
import { operatorLogModuleKey, operatorLogResultKey, operatorLogTypeKey, operatorRiskLevelKey, clearLimit } from '../types/const';
|
||||
import { labelFilter } from '@/types/form';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
|
||||
@@ -96,6 +105,7 @@
|
||||
riskLevel: undefined,
|
||||
result: undefined,
|
||||
startTimeRange: undefined,
|
||||
clearLimit,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -136,6 +146,10 @@
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
if (!formModel.value.clearLimit) {
|
||||
Message.error('请输入清理数量');
|
||||
return false;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
// 获取总数量
|
||||
@@ -158,7 +172,7 @@
|
||||
const doClear = (count: number) => {
|
||||
Modal.confirm({
|
||||
title: '删除清空',
|
||||
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
|
||||
onOk: async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
||||
@@ -27,6 +27,9 @@ export const getLogDetail = (record: OperatorLogQueryResponse): Record<string, a
|
||||
}
|
||||
};
|
||||
|
||||
// 清理数量
|
||||
export const clearLimit = 2000;
|
||||
|
||||
// 操作日志模块 字典项
|
||||
export const operatorLogModuleKey = 'operatorLogModule';
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ INSERT INTO `dict_value` VALUES (405, 53, 'terminalTheme', '{\"background\":\"#1
|
||||
-- 菜单配置
|
||||
INSERT INTO `system_menu` VALUES (1, 0, '工作台', NULL, 1, 10, 1, 1, 1, 0, 'IconComputer', NULL, 'workplace', '2023-07-28 10:51:50', '2023-09-11 15:27:52', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (5, 0, '用户管理', NULL, 1, 700, 1, 1, 1, 0, 'icon-user', NULL, 'userModule', '2023-07-28 10:55:38', '2024-06-17 20:45:29', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (8, 0, '项目地址', NULL, 1, 1000, 1, 1, 1, 0, 'icon-link', 'https://lijiahangmax.github.io/open-orion/orion-visor', '', '2023-07-28 11:04:59', '2024-05-31 17:13:12', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (8, 0, '项目地址', NULL, 1, 1000, 1, 1, 1, 0, 'icon-link', 'https://visor.orionsec.cn', '', '2023-07-28 11:04:59', '2024-05-31 17:13:12', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (10, 5, '角色管理', NULL, 2, 10, 1, 1, 1, 0, 'IconUserGroup', '', 'role', '2023-07-28 10:55:52', '2024-03-07 19:10:13', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (12, 0, '系统管理', NULL, 1, 800, 1, 1, 1, 0, 'icon-tool', NULL, 'systemModule', '2023-08-02 18:24:24', '2024-06-17 20:45:39', '1', '1', 0);
|
||||
INSERT INTO `system_menu` VALUES (13, 12, '系统菜单', '', 2, 10, 1, 1, 1, 0, 'icon-menu', NULL, 'systemMenu', '2023-08-02 18:29:01', '2024-03-07 22:25:00', '1', '1', 0);
|
||||
|
||||
Reference in New Issue
Block a user