Folders: Allow listing folders with write permission (#83527)

* Folders: Allow listing folders with write permission

* Check for subfolder access if parent does not have

* Add test

* GetFolders: fix ordering

* Apply suggestion from code review
This commit is contained in:
Sofia Papagiannaki
2024-03-15 14:05:27 +02:00
committed by GitHub
parent 39232a0776
commit 1208888bb6
9 changed files with 347 additions and 16 deletions
+8
View File
@@ -7,6 +7,7 @@ import (
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/infra/slugify"
"github.com/grafana/grafana/pkg/services/auth/identity"
"github.com/grafana/grafana/pkg/services/dashboards/dashboardaccess"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/errutil"
)
@@ -163,6 +164,10 @@ type GetFoldersQuery struct {
WithFullpathUIDs bool
BatchSize uint64
// OrderByTitle is used to sort the folders by title
// Set to true when ordering is meaningful (used for listing folders)
// otherwise better to keep it false since ordering can have a performance impact
OrderByTitle bool
SignedInUser identity.Requester `json:"-"`
}
@@ -185,6 +190,9 @@ type GetChildrenQuery struct {
Limit int64
Page int64
// Permission to filter by
Permission dashboardaccess.PermissionType
SignedInUser identity.Requester `json:"-"`
// array of folder uids to filter by