mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #11786 from marefr/11625_save_as
dashboard: show save as button if user has edit permission This will show the "Save As..." button in dashboard settings page if the user has edit permissions (org role admin/editor or viewers_can_edit enabled) and has at least edit permission in any folder.
This commit is contained in:
@@ -11,6 +11,7 @@ export class User {
|
||||
timezone: string;
|
||||
helpFlags1: number;
|
||||
lightTheme: boolean;
|
||||
hasEditPermissionInFolders: boolean;
|
||||
|
||||
constructor() {
|
||||
if (config.bootData.user) {
|
||||
@@ -28,6 +29,7 @@ export class ContextSrv {
|
||||
isEditor: any;
|
||||
sidemenu: any;
|
||||
sidemenuSmallBreakpoint = false;
|
||||
hasEditPermissionInFolders: boolean;
|
||||
|
||||
constructor() {
|
||||
this.sidemenu = store.getBool('grafana.sidemenu', true);
|
||||
@@ -44,6 +46,7 @@ export class ContextSrv {
|
||||
this.isSignedIn = this.user.isSignedIn;
|
||||
this.isGrafanaAdmin = this.user.isGrafanaAdmin;
|
||||
this.isEditor = this.hasRole('Editor') || this.hasRole('Admin');
|
||||
this.hasEditPermissionInFolders = this.user.hasEditPermissionInFolders;
|
||||
}
|
||||
|
||||
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.canDelete = this.dashboard.meta.canSave;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user