Skip to content

Commit

Permalink
Merge pull request #2571 from actiontech/sqle-1785
Browse files Browse the repository at this point in the history
当用户编辑黑/白名单的匹配类型或匹配内容,该条记录的匹配次数和匹配时间将会被重置
  • Loading branch information
LordofAvernus authored Aug 30, 2024
2 parents 489fee5 + efa082f commit 8f7e83c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sqle/api/controller/v1/blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func UpdateBlacklist(c echo.Context) error {
blacklist.Desc = *req.Desc
}

if req.Content != nil || req.Type != nil {
blacklist.MatchedCount = 0
blacklist.LastMatchTime = nil
}

err = s.Save(blacklist)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
Expand Down
6 changes: 6 additions & 0 deletions sqle/api/controller/v1/sql_whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func UpdateAuditWhitelistById(c echo.Context) error {
if req.MatchType != nil {
sqlWhitelist.MatchType = *req.MatchType
}

if req.Value != nil || req.MatchType != nil {
sqlWhitelist.MatchedCount = 0
sqlWhitelist.LastMatchedTime = nil
}

if req.Desc != nil {
sqlWhitelist.Desc = *req.Desc
}
Expand Down

0 comments on commit 8f7e83c

Please sign in to comment.