From ddd782d623cb6054e34ccc4c19b56ea80ce352e5 Mon Sep 17 00:00:00 2001 From: uubulb Date: Sat, 21 Dec 2024 23:41:39 +0800 Subject: [PATCH] cover? --- cmd/dashboard/controller/alertrule.go | 14 +------------- cmd/dashboard/controller/service.go | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/cmd/dashboard/controller/alertrule.go b/cmd/dashboard/controller/alertrule.go index 42842b2..c8b0dab 100644 --- a/cmd/dashboard/controller/alertrule.go +++ b/cmd/dashboard/controller/alertrule.go @@ -168,20 +168,8 @@ func validateRule(c *gin.Context, r *model.AlertRule) error { if len(r.Rules) > 0 { for _, rule := range r.Rules { singleton.ServerLock.RLock() - isCoverAll := rule.Cover == model.RuleCoverAll - isCoverIgnoreAll := rule.Cover == model.RuleCoverIgnoreAll for s, enabled := range rule.Ignore { - if isCoverAll { - for id, server := range singleton.ServerList { - if enabled && id == s { - continue - } - if !server.HasPermission(c) { - singleton.ServerLock.RUnlock() - return singleton.Localizer.ErrorT("permission denied") - } - } - } else if isCoverIgnoreAll && enabled { + if enabled { if server, ok := singleton.ServerList[s]; ok { if !server.HasPermission(c) { singleton.ServerLock.RUnlock() diff --git a/cmd/dashboard/controller/service.go b/cmd/dashboard/controller/service.go index 51032c3..a87621c 100644 --- a/cmd/dashboard/controller/service.go +++ b/cmd/dashboard/controller/service.go @@ -364,20 +364,8 @@ func validateServers(c *gin.Context, ss *model.Service) error { singleton.ServerLock.RLock() defer singleton.ServerLock.RUnlock() - isCoverAll := ss.Cover == model.ServiceCoverAll - isCoverIgnoreAll := ss.Cover == model.ServiceCoverIgnoreAll - for s, enabled := range ss.SkipServers { - if isCoverAll { - for id, server := range singleton.ServerList { - if enabled && id == s { - continue - } - if !server.HasPermission(c) { - return singleton.Localizer.ErrorT("permission denied") - } - } - } else if isCoverIgnoreAll && enabled { + if enabled { if server, ok := singleton.ServerList[s]; ok { if !server.HasPermission(c) { return singleton.Localizer.ErrorT("permission denied")