mirror of
https://github.com/grafana/grafana.git
synced 2026-07-29 15:59:50 -05:00
dashboard: show save as button if can edit and has edit permission to folders
This commit is contained in:
@@ -11,6 +11,7 @@ export class User {
|
|||||||
timezone: string;
|
timezone: string;
|
||||||
helpFlags1: number;
|
helpFlags1: number;
|
||||||
lightTheme: boolean;
|
lightTheme: boolean;
|
||||||
|
hasEditPermissionInFolders: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (config.bootData.user) {
|
if (config.bootData.user) {
|
||||||
@@ -28,6 +29,7 @@ export class ContextSrv {
|
|||||||
isEditor: any;
|
isEditor: any;
|
||||||
sidemenu: any;
|
sidemenu: any;
|
||||||
sidemenuSmallBreakpoint = false;
|
sidemenuSmallBreakpoint = false;
|
||||||
|
hasEditPermissionInFolders: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.sidemenu = store.getBool('grafana.sidemenu', true);
|
this.sidemenu = store.getBool('grafana.sidemenu', true);
|
||||||
@@ -44,6 +46,7 @@ export class ContextSrv {
|
|||||||
this.isSignedIn = this.user.isSignedIn;
|
this.isSignedIn = this.user.isSignedIn;
|
||||||
this.isGrafanaAdmin = this.user.isGrafanaAdmin;
|
this.isGrafanaAdmin = this.user.isGrafanaAdmin;
|
||||||
this.isEditor = this.hasRole('Editor') || this.hasRole('Admin');
|
this.isEditor = this.hasRole('Editor') || this.hasRole('Admin');
|
||||||
|
this.hasEditPermissionInFolders = this.user.hasEditPermissionInFolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasRole(role) {
|
hasRole(role) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export class SettingsCtrl {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.canSaveAs = contextSrv.isEditor;
|
this.canSaveAs = this.dashboard.meta.canEdit && contextSrv.hasEditPermissionInFolders;
|
||||||
this.canSave = this.dashboard.meta.canSave;
|
this.canSave = this.dashboard.meta.canSave;
|
||||||
this.canDelete = this.dashboard.meta.canSave;
|
this.canDelete = this.dashboard.meta.canSave;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user