Dashboard: Fix editor specific permissions in /api (#113292)

This commit is contained in:
Stephanie Hingtgen
2025-10-31 09:03:35 -05:00
committed by GitHub
parent f6e4dd9b0c
commit ea90bdff9c
2 changed files with 137 additions and 2 deletions
@@ -676,11 +676,14 @@ func (dr *DashboardServiceImpl) BuildSaveDashboardCommand(ctx context.Context, d
// Validate folder
if dash.FolderID != 0 || dash.FolderUID != "" { // nolint:staticcheck
folder, err := dr.folderService.Get(ctx, &folder.GetFolderQuery{
// use a background requester, because the user may have been granted edit access to that specific dashboard, but
// not have access to the parent folder. we should still allow editing in that case.
ctxIdentity, backgroundRequester := identity.WithServiceIdentity(ctx, dash.OrgID)
folder, err := dr.folderService.Get(ctxIdentity, &folder.GetFolderQuery{
OrgID: dash.OrgID,
UID: &dash.FolderUID,
ID: &dash.FolderID, // nolint:staticcheck
SignedInUser: dto.User,
SignedInUser: backgroundRequester,
})
if err != nil {
return nil, err