Sqlstore: guard against getting a dashboard without specifying identi… (#22246)

* Sqlstore: guard against getting a dashboard without specifying identifier

* Sqlstore: linting
This commit is contained in:
Leonard Gram
2020-02-17 15:32:20 +01:00
committed by GitHub
parent 0c4dae321c
commit 10fbabfb2e
3 changed files with 14 additions and 0 deletions
+4
View File
@@ -169,6 +169,10 @@ func generateNewDashboardUid(sess *DBSession, orgId int64) (string, error) {
}
func GetDashboard(query *models.GetDashboardQuery) error {
if query.Id == 0 && len(query.Slug) == 0 && len(query.Uid) == 0 {
return models.ErrDashboardIdentifierNotSet
}
dashboard := models.Dashboard{Slug: query.Slug, OrgId: query.OrgId, Id: query.Id, Uid: query.Uid}
has, err := x.Get(&dashboard)