Folders: GetFolders to return empty respons if user does not have any permissions (#81304)

add check for list of permissions
This commit is contained in:
Yuri Tseretyan authored and GitHub committed 2024-01-26 19:12:45 +02:00
1 parent 09fcb3c6cc
commit a081abdd25
2 files changed
+14

No files matched your search

+3
View File
@@ -131,6 +131,9 @@ func (s *Service) GetFolders(ctx context.Context, q folder.GetFoldersQuery) ([]*
permissions := q.SignedInUser.GetPermissions()
folderPermissions := permissions[dashboards.ActionFoldersRead]
qry.ancestorUIDs = make([]string, 0, len(folderPermissions))
if len(folderPermissions) == 0 && !q.SignedInUser.GetIsGrafanaAdmin() {
return nil, nil
}
for _, p := range folderPermissions {
if p == dashboards.ScopeFoldersAll {
// no need to query for folders with permissions