]> git.proxmox.com Git - pve-manager.git/commitdiff
Improve HA UI for users with restricted permissions
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 30 Oct 2015 14:15:00 +0000 (15:15 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 30 Oct 2015 15:11:42 +0000 (16:11 +0100)
Only show edit dialogs for HA resources and groups when an user
has the privileges to edit them.

www/manager/ha/Groups.js
www/manager/ha/Resources.js

index 786327e92755139588927306cc877459aaaa4754..e596c00a88e91f5c979afcb45d6a8fd1d39dcce7 100644 (file)
@@ -5,6 +5,8 @@ Ext.define('PVE.ha.GroupsView', {
     initComponent : function() {
        var me = this;
 
+       var caps = Ext.state.Manager.get('GuiCap');
+
        var store = new Ext.data.Store({
            model: 'pve-ha-groups',
            sorters: { 
@@ -67,6 +69,7 @@ Ext.define('PVE.ha.GroupsView', {
            tbar: [
                {
                    text: gettext('Create'),
+                   disabled: !caps.nodes['Sys.Console'],
                    handler: function() {
                        var win = Ext.create('PVE.ha.GroupEdit',{});
                        win.on('destroy', reload);
@@ -110,6 +113,11 @@ Ext.define('PVE.ha.GroupsView', {
            ],
            listeners: {
                show: reload,
+               beforeselect: function(grid, record, index, eOpts) {
+                   if (!caps.nodes['Sys.Console']) {
+                       return false;
+                   }
+               },
                itemdblclick: run_editor
            }
        });
index a8212bd976c5f648d8d647582d68aed4b8f6d0d6..495f039bbcf102d698d8c13f87c9ea0b250c4fb4 100644 (file)
@@ -5,6 +5,8 @@ Ext.define('PVE.ha.ResourcesView', {
     initComponent : function() {
        var me = this;
 
+       var caps = Ext.state.Manager.get('GuiCap');
+
        var store = new Ext.data.Store({
            model: 'pve-ha-resources',
            proxy: {
@@ -93,6 +95,7 @@ Ext.define('PVE.ha.ResourcesView', {
            tbar: [
                {
                    text: gettext('Add'),
+                   disabled: !caps.nodes['Sys.Console'],
                    handler: function() {
                        var win = Ext.create('PVE.ha.VMResourceEdit',{});
                        win.on('destroy', reload);
@@ -135,6 +138,11 @@ Ext.define('PVE.ha.ResourcesView', {
            ],
            listeners: {
                show: reload,
+               beforeselect: function(grid, record, index, eOpts) {
+                   if (!caps.nodes['Sys.Console']) {
+                       return false;
+                   }
+               },
                itemdblclick: run_editor
            }
        });