ensure that if the dasboardID is negative, it will not bypass the checking of the right (#12398)

This commit is contained in:
Augustin 2018-06-26 14:12:20 +02:00 committed by Torkel Ödegaard
parent 5a2cf5863d
commit ef0bf9f701

View File

@ -272,9 +272,9 @@ func canSaveByDashboardID(c *m.ReqContext, dashboardID int64) (bool, error) {
return false, nil
}
if dashboardID > 0 {
guardian := guardian.New(dashboardID, c.OrgId, c.SignedInUser)
if canEdit, err := guardian.CanEdit(); err != nil || !canEdit {
if dashboardID != 0 {
guard := guardian.New(dashboardID, c.OrgId, c.SignedInUser)
if canEdit, err := guard.CanEdit(); err != nil || !canEdit {
return false, err
}
}