PublicDashboards: use orgId when querying dashboards (#57696)
This commit is contained in:
@@ -33,7 +33,7 @@ func ProvideStore(sqlStore db.DB) *PublicDashboardStoreImpl {
|
||||
}
|
||||
}
|
||||
|
||||
// Gets list of public dashboards by orgId
|
||||
// FindAll Returns a list of public dashboards by orgId
|
||||
func (d *PublicDashboardStoreImpl) FindAll(ctx context.Context, orgId int64) ([]PublicDashboardListResponse, error) {
|
||||
resp := make([]PublicDashboardListResponse, 0)
|
||||
|
||||
@@ -55,8 +55,8 @@ func (d *PublicDashboardStoreImpl) FindAll(ctx context.Context, orgId int64) ([]
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *PublicDashboardStoreImpl) FindDashboard(ctx context.Context, dashboardUid string) (*models.Dashboard, error) {
|
||||
dashboard := &models.Dashboard{Uid: dashboardUid}
|
||||
func (d *PublicDashboardStoreImpl) FindDashboard(ctx context.Context, dashboardUid string, orgId int64) (*models.Dashboard, error) {
|
||||
dashboard := &models.Dashboard{Uid: dashboardUid, OrgId: orgId}
|
||||
err := d.sqlStore.WithTransactionalDbSession(ctx, func(sess *db.Session) error {
|
||||
has, err := sess.Get(dashboard)
|
||||
if err != nil {
|
||||
|
||||
@@ -81,7 +81,7 @@ func TestIntegrationFindDashboard(t *testing.T) {
|
||||
t.Run("FindDashboard can get original dashboard by uid", func(t *testing.T) {
|
||||
setup()
|
||||
|
||||
dashboard, err := publicdashboardStore.FindDashboard(context.Background(), savedDashboard.Uid)
|
||||
dashboard, err := publicdashboardStore.FindDashboard(context.Background(), savedDashboard.Uid, savedDashboard.OrgId)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, savedDashboard.Uid, dashboard.Uid)
|
||||
|
||||
Reference in New Issue
Block a user