Plugins: Expose functions to plugins for checking RBAC permissions (#89047)

* feat(grafana-data): create rbac functions for checking permissions

* feat(grafana-runtime): pass current user to runtime

* feat(grafana-runtime): expose rbac functions to check permissions against current user

* refactor(contextsrv): use functions from grafana/data to check rbac permissions against user

* Apply suggestions from code review

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* chore(rbac): fix missing types imports

* refactor(rbac): make exposed functions return boolean

---------

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
Jack Westbrook
2024-06-26 17:29:17 +02:00
committed by GitHub
parent 7f4faaa45b
commit 40207c53ae
8 changed files with 89 additions and 4 deletions

View File

@@ -38,6 +38,7 @@ import {
setReturnToPreviousHook,
setPluginExtensionsHook,
setPluginComponentHook,
setCurrentUser,
} from '@grafana/runtime';
import { setPanelDataErrorView } from '@grafana/runtime/src/components/PanelDataErrorView';
import { setPanelRenderer } from '@grafana/runtime/src/components/PanelRenderer';
@@ -144,6 +145,7 @@ export class GrafanaApp {
setEmbeddedDashboard(EmbeddedDashboardLazy);
setTimeZoneResolver(() => config.bootData.user.timezone);
initGrafanaLive();
setCurrentUser(contextSrv.user);
initAuthConfig();