mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
chore: sqlstore cleanup (#60415)
* chore: remove unused test helper from sqlstore TimeNow() is no longer used in any tests in this package. * chore: move sqlstore.SQLBuilder to the infra/db package This required some minor refactoring; we need to be a little more explicit about passing around the dialect and engine. On the other hand, that's a few fewer uses of the `dialect` global constant! * chore: move UserDeletions into the only package using it * cleanup around moving sqlbuilder * remove dialect and sqlog global vars * rename userDeletions to serviceAccountDeletions
This commit is contained in:
@@ -103,7 +103,7 @@ func (d *DashboardStore) HasEditPermissionInFolders(ctx context.Context, query *
|
||||
return nil
|
||||
}
|
||||
|
||||
builder := db.NewSqlBuilder(d.cfg)
|
||||
builder := db.NewSqlBuilder(d.cfg, d.store.GetDialect())
|
||||
builder.Write("SELECT COUNT(dashboard.id) AS count FROM dashboard WHERE dashboard.org_id = ? AND dashboard.is_folder = ?",
|
||||
query.SignedInUser.OrgID, d.store.GetDialect().BooleanStr(true))
|
||||
builder.WriteDashboardPermissionFilter(query.SignedInUser, models.PERMISSION_EDIT)
|
||||
@@ -131,7 +131,7 @@ func (d *DashboardStore) HasAdminPermissionInDashboardsOrFolders(ctx context.Con
|
||||
return nil
|
||||
}
|
||||
|
||||
builder := db.NewSqlBuilder(d.cfg)
|
||||
builder := db.NewSqlBuilder(d.cfg, d.store.GetDialect())
|
||||
builder.Write("SELECT COUNT(dashboard.id) AS count FROM dashboard WHERE dashboard.org_id = ?", query.SignedInUser.OrgID)
|
||||
builder.WriteDashboardPermissionFilter(query.SignedInUser, models.PERMISSION_ADMIN)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user