Merge remote-tracking branch 'origin/master' into haskafka
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package com.realtime.protection.configuration.entity.rule.dynamicrule;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.realtime.protection.configuration.entity.defense.object.ProtectObject;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
@@ -95,4 +98,22 @@ public class DynamicRuleObject {
|
||||
@JsonProperty("log_rule_id")
|
||||
@Schema(description = "筛选条件-日志规则id", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long logRuleId;
|
||||
|
||||
|
||||
@JsonProperty("dynamic_rule_audit_status")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "动态规则审核状态(0为未审核,1为已退回,2为审核通过)", example = "2", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer auditStatus;
|
||||
|
||||
public void checkAuditStatusValidate(AuditStatusEnum newAuditStatus) {
|
||||
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
||||
throw new IllegalArgumentException("规则《" + this.getDynamicRuleName() + "》原审批状态非法");
|
||||
}
|
||||
|
||||
if (!AuditStatusValidator
|
||||
.setOriginal(this.getAuditStatus())
|
||||
.checkValidate(newAuditStatus.getNum())) {
|
||||
throw new IllegalArgumentException("规则《" + this.getDynamicRuleName() + "》审核状态错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.realtime.protection.configuration.entity.rule.staticrule;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
@@ -14,6 +16,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@@ -47,7 +50,7 @@ public class StaticRuleObject {
|
||||
@JsonProperty("static_rule_audit_status")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "静态规则审核状态(0为未审核,1为已退回,2为审核通过)", example = "2", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer staticRuleAuditStatus;
|
||||
private Integer auditStatus;
|
||||
@JsonProperty("static_rule_create_depart")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "静态规则创建用户所属部门", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@@ -142,4 +145,15 @@ public class StaticRuleObject {
|
||||
@Schema(description = "频率,最低为1", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer staticRuleFrequency;
|
||||
|
||||
public void checkAuditStatusValidate(AuditStatusEnum newAuditStatus) {
|
||||
if (!List.of(AuditStatusEnum.AUDITED.getNum(), AuditStatusEnum.USING.getNum()).contains(this.getAuditStatus())) {
|
||||
throw new IllegalArgumentException("规则《" + this.getStaticRuleName() + "》原审批状态非法");
|
||||
}
|
||||
|
||||
if (!AuditStatusValidator
|
||||
.setOriginal(this.getAuditStatus())
|
||||
.checkValidate(newAuditStatus.getNum())) {
|
||||
throw new IllegalArgumentException("规则《" + this.getStaticRuleName() + "》审核状态错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,9 @@ public class FiveTupleWithMask {
|
||||
|
||||
public void setProtocolNum() {
|
||||
ProtocolEnum protocol = ProtocolEnum.getProtocolEnumByProtocol(this.protocol);
|
||||
assert protocol != null;
|
||||
if (protocol == null) {
|
||||
return;
|
||||
}
|
||||
this.protocolNum = protocol.getNumber();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,10 +140,16 @@ public class TaskCommandInfo {
|
||||
}
|
||||
|
||||
public void setProtocolNum() {
|
||||
if (this.fiveTupleWithMask == null) {
|
||||
return;
|
||||
}
|
||||
this.fiveTupleWithMask.setProtocolNum();
|
||||
}
|
||||
|
||||
public void setMask() {
|
||||
if (this.fiveTupleWithMask == null) {
|
||||
return;
|
||||
}
|
||||
this.fiveTupleWithMask.setMask();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.realtime.protection.configuration.entity.user;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Yixiang Zhao
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AccessTokenResponse {
|
||||
private String access_token;
|
||||
private String token_type;
|
||||
private int expires_in;
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package com.realtime.protection.configuration.entity.user;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class User {
|
||||
private Long userId;
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.realtime.protection.configuration.entity.user;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* @author Yixiang Zhao
|
||||
**/
|
||||
public class UserFull {
|
||||
public String ticket;
|
||||
public List<Group> groups;
|
||||
public List<Role> roles;
|
||||
public List<Org> orgs;
|
||||
public String mobile;
|
||||
public String nickName;
|
||||
public String email;
|
||||
public String uid;
|
||||
public String employeeNumber;
|
||||
public String name;
|
||||
public List<String> resoures;
|
||||
|
||||
public String getOrgCode() {
|
||||
if (orgs.size() > 0) {
|
||||
return orgs.get(0).orgCode;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getRoleKey() {
|
||||
if (roles.size() > 0) {
|
||||
return roles.get(0).roleKey;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class Group {
|
||||
public int groupId;
|
||||
public int applicationId;
|
||||
public String groupKey;
|
||||
public String groupName;
|
||||
public String groupTag; // Assume it's a JSON String, otherwise it could be List<Tag> or similar
|
||||
public String groupRemark;
|
||||
}
|
||||
|
||||
class Role {
|
||||
public int roleId;
|
||||
public int applicationId;
|
||||
public String roleKey;
|
||||
public String roleName;
|
||||
public String roleRemark;
|
||||
public String roleTag; // Same assumption as above
|
||||
public List<String> res; // Assuming a Resource class exists
|
||||
public List<String> resources; // Assuming a Resource class exists
|
||||
}
|
||||
|
||||
class Org {
|
||||
public String orgName;
|
||||
public String orgDescription;
|
||||
public int orgParentId;
|
||||
public String orgCode;
|
||||
public String orgTag; // Same assumption as above
|
||||
public int orgId;
|
||||
public String userOrgworkType;
|
||||
}
|
||||
Reference in New Issue
Block a user