Alerting: Verify receiver permission read on rule create/update (#94286)
* Alerting: Verify receiver permission read on rule create/update
This commit is contained in:
@@ -35,6 +35,10 @@ type NotificationSettings struct {
|
||||
MuteTimeIntervals []string `json:"mute_time_intervals,omitempty"`
|
||||
}
|
||||
|
||||
func (s *NotificationSettings) GetUID() string {
|
||||
return NameToUid(s.Receiver)
|
||||
}
|
||||
|
||||
// NormalizedGroupBy returns a consistent and ordered GroupBy.
|
||||
// - If the GroupBy is empty, it returns nil so that the parent group can be inherited.
|
||||
// - If the GroupBy contains the special label '...', it returns only '...'.
|
||||
|
||||
@@ -2,6 +2,7 @@ package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -559,6 +560,10 @@ func (r *Receiver) GetUID() string {
|
||||
return r.UID
|
||||
}
|
||||
|
||||
func NameToUid(name string) string {
|
||||
return base64.RawURLEncoding.EncodeToString([]byte(name))
|
||||
}
|
||||
|
||||
func (r *Receiver) Fingerprint() string {
|
||||
sum := newFingerprint()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user