mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
21 lines
485 B
Go
21 lines
485 B
Go
|
package ngalert
|
||
|
|
||
|
import (
|
||
|
"github.com/grafana/grafana/pkg/models"
|
||
|
)
|
||
|
|
||
|
func (ng *AlertNG) validateOrgAlertDefinition(c *models.ReqContext) {
|
||
|
id := c.ParamsInt64(":alertDefinitionId")
|
||
|
query := getAlertDefinitionByIDQuery{ID: id}
|
||
|
|
||
|
if err := ng.getAlertDefinitionByID(&query); err != nil {
|
||
|
c.JsonApiErr(404, "Alert definition not found", nil)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
if c.OrgId != query.Result.OrgId {
|
||
|
c.JsonApiErr(403, "You are not allowed to edit/view alert definition", nil)
|
||
|
return
|
||
|
}
|
||
|
}
|