From 8ac9c47222eeac362054b758fa073ff36bea996a Mon Sep 17 00:00:00 2001 From: Stephanie Hingtgen Date: Mon, 3 Feb 2025 16:08:15 -0700 Subject: [PATCH] Folders: Validator: add temporary fix (#100019) --- .../accesscontrol/ossaccesscontrol/folder.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/services/accesscontrol/ossaccesscontrol/folder.go b/pkg/services/accesscontrol/ossaccesscontrol/folder.go index 0ca7921723c..050570868f6 100644 --- a/pkg/services/accesscontrol/ossaccesscontrol/folder.go +++ b/pkg/services/accesscontrol/ossaccesscontrol/folder.go @@ -2,6 +2,7 @@ package ossaccesscontrol import ( "context" + "errors" "github.com/grafana/grafana/pkg/api/routing" "github.com/grafana/grafana/pkg/apimachinery/identity" @@ -106,6 +107,17 @@ func ProvideFolderPermissions( }) if err != nil { + // if the folder is not found, this may be on the create path, + // where the write path to legacy will then go through the read + // path and try to read from both legacy & unified before it exists on both + if features.IsEnabledGlobally(featuremgmt.FlagKubernetesFoldersServiceV2) && errors.Is(err, dashboards.ErrFolderNotFound) { + _, err = folderService.GetLegacy(ctx, &folder.GetFolderQuery{ + UID: &resourceID, + OrgID: orgID, + SignedInUser: ident, + }) + return err + } return err }