Skip to content

Commit

Permalink
modify SystemUserFilterRule Json data
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Jun 10, 2020
1 parent 4611a38 commit 93ad8cb
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions pkg/model/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,10 @@ const (
)

type SystemUserFilterRule struct {
Priority int `json:"priority"`
Type struct {
Value string `json:"value"`
} `json:"type"`
Content string `json:"content"`
Action struct {
Value RuleAction `json:"value"`
} `json:"action"`
Priority int `json:"priority"`
Type string `json:"type"`
Content string `json:"content"`
Action RuleAction `json:"action"`

pattern *regexp.Regexp
compiled bool
Expand All @@ -313,7 +309,7 @@ func (sf *SystemUserFilterRule) Pattern() *regexp.Regexp {
return sf.pattern
}
var regexs string
if sf.Type.Value == TypeCmd {
if sf.Type == TypeCmd {
var regex []string
for _, cmd := range strings.Split(sf.Content, "\r\n") {
cmd = regexp.QuoteMeta(cmd)
Expand Down Expand Up @@ -346,5 +342,5 @@ func (sf *SystemUserFilterRule) Match(cmd string) (RuleAction, string) {
if found == "" {
return ActionUnknown, ""
}
return sf.Action.Value, found
return sf.Action, found
}

0 comments on commit 93ad8cb

Please sign in to comment.