From 30e5410f4e2bc710ddd06bfbd07d7e930f485c16 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:35:57 +0200 Subject: [PATCH] [v11.4.x] RBAC: Don't check folder access if `annotationPermissionUpdate` FT is enabled (#100116) RBAC: Don't check folder access if `annotationPermissionUpdate` FT is enabled (#99717) don't check folder access if annotation permission update is enabled (cherry picked from commit 095593c018094a23bb0010368d16fd70192c46bd) Co-authored-by: Ieva --- .../scene/setDashboardPanelContext.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/setDashboardPanelContext.ts b/public/app/features/dashboard-scene/scene/setDashboardPanelContext.ts index 4b141354801..f4e053f2e0e 100644 --- a/public/app/features/dashboard-scene/scene/setDashboardPanelContext.ts +++ b/public/app/features/dashboard-scene/scene/setDashboardPanelContext.ts @@ -18,7 +18,12 @@ export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelConte const builtInLayer = getBuiltInAnnotationsLayer(dashboard); // When there is no builtin annotations query we disable the ability to add annotations - if (!builtInLayer || !dashboard.canEditDashboard()) { + if (!builtInLayer) { + return false; + } + + // If feature flag is enabled we pass the info of whether annotation can be added through the dashboard permissions + if (!config.featureToggles.annotationPermissionUpdate && !dashboard.canEditDashboard()) { return false; } @@ -29,7 +34,8 @@ export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelConte context.canEditAnnotations = (dashboardUID?: string) => { const dashboard = getDashboardSceneFor(vizPanel); - if (!dashboard.canEditDashboard()) { + // If feature flag is enabled we pass the info of whether annotation can be edited through the dashboard permissions + if (!config.featureToggles.annotationPermissionUpdate && !dashboard.canEditDashboard()) { return false; } @@ -43,7 +49,8 @@ export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelConte context.canDeleteAnnotations = (dashboardUID?: string) => { const dashboard = getDashboardSceneFor(vizPanel); - if (!dashboard.canEditDashboard()) { + // If feature flag is enabled we pass the info of whether annotation can be deleted through the dashboard permissions + if (!config.featureToggles.annotationPermissionUpdate && !dashboard.canEditDashboard()) { return false; }