Skip to content

Commit a775fec

Browse files
alpinskiyrazmser
authored andcommitted
API remove edit RAW tag restriction
1 parent 5b3ffa8 commit a775fec

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

internal/api/handler.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,12 +1709,6 @@ func (h *Handler) handlePostMetric(ctx context.Context, ai accessInfo, _ string,
17091709
return format.MetricMetaValue{},
17101710
httpErr(http.StatusForbidden, fmt.Errorf("can't edit metric %q", old.Name))
17111711
}
1712-
if diffContainsRawTagChanges(*old, metric) {
1713-
if isAdmin := ai.isAdmin() || ai.insecureMode; !isAdmin {
1714-
return format.MetricMetaValue{}, httpErr(http.StatusForbidden,
1715-
fmt.Errorf("raw tags can only be edited by administrators, please contact the support group"))
1716-
}
1717-
}
17181712
resp, err = h.metadataLoader.SaveMetric(ctx, metric, ai.toMetadata())
17191713
if err != nil {
17201714
if metajournal.IsUserRequestError(err) {
@@ -1727,26 +1721,6 @@ func (h *Handler) handlePostMetric(ctx context.Context, ai accessInfo, _ string,
17271721
return resp, nil
17281722
}
17291723

1730-
func diffContainsRawTagChanges(old, new format.MetricMetaValue) bool {
1731-
for i := 0; i < len(old.Tags) && i < len(new.Tags); i++ {
1732-
if old.Tags[i].Raw != new.Tags[i].Raw {
1733-
return true // edit
1734-
}
1735-
if old.Tags[i].Raw64() != new.Tags[i].Raw64() {
1736-
return true // edit
1737-
}
1738-
}
1739-
for i := len(new.Tags); i < len(old.Tags); i++ {
1740-
if old.Tags[i].Raw {
1741-
return true // removal
1742-
}
1743-
if old.Tags[i].Raw64() {
1744-
return true // removal
1745-
}
1746-
}
1747-
return false
1748-
}
1749-
17501724
func HandleGetMetricTagValues(r *httpRequestHandler) {
17511725
ctx, cancel := context.WithTimeout(r.Context(), r.querySelectTimeout)
17521726
defer cancel()

0 commit comments

Comments
 (0)