FindDashboards: filter by dashboard type (#100160)

This commit is contained in:
Stephanie Hingtgen
2025-02-05 18:57:26 -06:00
committed by GitHub
parent f7d476e408
commit 495aa65c6e
6 changed files with 176 additions and 10 deletions
+2
View File
@@ -21,6 +21,7 @@ import (
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/search"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/services/sqlstore/searchstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
)
@@ -252,6 +253,7 @@ func (l *LibraryElementService) deleteLibraryElement(c context.Context, signedIn
// then find the dashboards that were supposed to be connected to this element
_, requester := identity.WithServiceIdentity(c, signedInUser.GetOrgID())
dashs, err := l.dashboardsService.FindDashboards(c, &dashboards.FindPersistedDashboardsQuery{
Type: searchstore.TypeDashboard,
OrgId: signedInUser.GetOrgID(),
DashboardIds: dashboardIDs,
SignedInUser: requester, // a user may be able to delete a library element but not read all dashboards. We still need to run this check, so we don't allow deleting elements if dashboards are connected