Access control: expose permissions to the frontend (#32954)

* Expose user permissions to the frontend

* Do not include empty scope

* Extend ContextSrv with hasPermission() method

* Add access control types

* Fix type error (make permissions optional)

* Fallback if access control disabled

* Move UserPermission to types

* Simplify hasPermission()
This commit is contained in:
Alexander Zobnin
2021-04-16 16:02:16 +03:00
committed by GitHub
parent 6ae73eaa22
commit 8b843eb0a6
8 changed files with 101 additions and 16 deletions

View File

@@ -46,6 +46,7 @@ export interface FeatureToggles {
live: boolean;
ngalert: boolean;
panelLibrary: boolean;
accesscontrol: boolean;
/**
* @remarks

View File

@@ -57,6 +57,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
ngalert: false,
panelLibrary: false,
reportVariables: false,
accesscontrol: false,
};
licenseInfo: LicenseInfo = {} as LicenseInfo;
rendererAvailable = false;