mirror of
https://github.com/grafana/grafana.git
synced 2025-09-21 12:42:59 +08:00
RBAC: Don't check folder access if annotationPermissionUpdate
FT is enabled (#99717)
don't check folder access if annotation permission update is enabled
This commit is contained in:
@ -18,7 +18,12 @@ export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelConte
|
|||||||
const builtInLayer = getBuiltInAnnotationsLayer(dashboard);
|
const builtInLayer = getBuiltInAnnotationsLayer(dashboard);
|
||||||
|
|
||||||
// When there is no builtin annotations query we disable the ability to add annotations
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +34,8 @@ export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelConte
|
|||||||
context.canEditAnnotations = (dashboardUID?: string) => {
|
context.canEditAnnotations = (dashboardUID?: string) => {
|
||||||
const dashboard = getDashboardSceneFor(vizPanel);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +49,8 @@ export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelConte
|
|||||||
context.canDeleteAnnotations = (dashboardUID?: string) => {
|
context.canDeleteAnnotations = (dashboardUID?: string) => {
|
||||||
const dashboard = getDashboardSceneFor(vizPanel);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user