mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove Result from dashboard models (#61997)
* Chore: Remove Result from dashboard models * Fix lint tests * Fix dashboard service tests * Fix API tests * Remove commented out code * Chore: Merge main - cleanup
This commit is contained in:
@@ -120,10 +120,11 @@ func ProvideDashboardPermissions(
|
||||
) (*DashboardPermissionsService, error) {
|
||||
getDashboard := func(ctx context.Context, orgID int64, resourceID string) (*dashboards.Dashboard, error) {
|
||||
query := &dashboards.GetDashboardQuery{UID: resourceID, OrgID: orgID}
|
||||
if _, err := dashboardStore.GetDashboard(ctx, query); err != nil {
|
||||
queryResult, err := dashboardStore.GetDashboard(ctx, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return query.Result, nil
|
||||
return queryResult, nil
|
||||
}
|
||||
|
||||
options := resourcepermissions.Options{
|
||||
@@ -148,10 +149,11 @@ func ProvideDashboardPermissions(
|
||||
}
|
||||
if dashboard.FolderID > 0 {
|
||||
query := &dashboards.GetDashboardQuery{ID: dashboard.FolderID, OrgID: orgID}
|
||||
if _, err := dashboardStore.GetDashboard(ctx, query); err != nil {
|
||||
queryResult, err := dashboardStore.GetDashboard(ctx, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []string{dashboards.ScopeFoldersProvider.GetResourceScopeUID(query.Result.UID)}, nil
|
||||
return []string{dashboards.ScopeFoldersProvider.GetResourceScopeUID(queryResult.UID)}, nil
|
||||
}
|
||||
return []string{}, nil
|
||||
},
|
||||
@@ -202,11 +204,12 @@ func ProvideFolderPermissions(
|
||||
ResourceAttribute: "uid",
|
||||
ResourceValidator: func(ctx context.Context, orgID int64, resourceID string) error {
|
||||
query := &dashboards.GetDashboardQuery{UID: resourceID, OrgID: orgID}
|
||||
if _, err := dashboardStore.GetDashboard(ctx, query); err != nil {
|
||||
queryResult, err := dashboardStore.GetDashboard(ctx, query)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !query.Result.IsFolder {
|
||||
if !queryResult.IsFolder {
|
||||
return errors.New("not found")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user