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
2024-01-26 19:12:45 +02:00
committed by GitHub
parent 09fcb3c6cc
commit a081abdd25
2 changed files with 14 additions and 0 deletions
+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