From 93ad8cbe2411266edfd95340b31bc0eb852ca50a Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 10 Jun 2020 14:21:20 +0800 Subject: [PATCH] modify SystemUserFilterRule Json data --- pkg/model/assets.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pkg/model/assets.go b/pkg/model/assets.go index cb9892b8c..0925c9320 100644 --- a/pkg/model/assets.go +++ b/pkg/model/assets.go @@ -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 @@ -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) @@ -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 }