Commit 20bbfc8b authored by Thomas Lamprecht's avatar Thomas Lamprecht Committed by Dietmar Maurer

Improve HA UI for users with restricted permissions

Only show edit dialogs for HA resources and groups when an user
has the privileges to edit them.
parent cc7c2b53
...@@ -5,6 +5,8 @@ Ext.define('PVE.ha.GroupsView', { ...@@ -5,6 +5,8 @@ Ext.define('PVE.ha.GroupsView', {
initComponent : function() { initComponent : function() {
var me = this; var me = this;
var caps = Ext.state.Manager.get('GuiCap');
var store = new Ext.data.Store({ var store = new Ext.data.Store({
model: 'pve-ha-groups', model: 'pve-ha-groups',
sorters: { sorters: {
...@@ -67,6 +69,7 @@ Ext.define('PVE.ha.GroupsView', { ...@@ -67,6 +69,7 @@ Ext.define('PVE.ha.GroupsView', {
tbar: [ tbar: [
{ {
text: gettext('Create'), text: gettext('Create'),
disabled: !caps.nodes['Sys.Console'],
handler: function() { handler: function() {
var win = Ext.create('PVE.ha.GroupEdit',{}); var win = Ext.create('PVE.ha.GroupEdit',{});
win.on('destroy', reload); win.on('destroy', reload);
...@@ -110,6 +113,11 @@ Ext.define('PVE.ha.GroupsView', { ...@@ -110,6 +113,11 @@ Ext.define('PVE.ha.GroupsView', {
], ],
listeners: { listeners: {
show: reload, show: reload,
beforeselect: function(grid, record, index, eOpts) {
if (!caps.nodes['Sys.Console']) {
return false;
}
},
itemdblclick: run_editor itemdblclick: run_editor
} }
}); });
......
...@@ -5,6 +5,8 @@ Ext.define('PVE.ha.ResourcesView', { ...@@ -5,6 +5,8 @@ Ext.define('PVE.ha.ResourcesView', {
initComponent : function() { initComponent : function() {
var me = this; var me = this;
var caps = Ext.state.Manager.get('GuiCap');
var store = new Ext.data.Store({ var store = new Ext.data.Store({
model: 'pve-ha-resources', model: 'pve-ha-resources',
proxy: { proxy: {
...@@ -93,6 +95,7 @@ Ext.define('PVE.ha.ResourcesView', { ...@@ -93,6 +95,7 @@ Ext.define('PVE.ha.ResourcesView', {
tbar: [ tbar: [
{ {
text: gettext('Add'), text: gettext('Add'),
disabled: !caps.nodes['Sys.Console'],
handler: function() { handler: function() {
var win = Ext.create('PVE.ha.VMResourceEdit',{}); var win = Ext.create('PVE.ha.VMResourceEdit',{});
win.on('destroy', reload); win.on('destroy', reload);
...@@ -135,6 +138,11 @@ Ext.define('PVE.ha.ResourcesView', { ...@@ -135,6 +138,11 @@ Ext.define('PVE.ha.ResourcesView', {
], ],
listeners: { listeners: {
show: reload, show: reload,
beforeselect: function(grid, record, index, eOpts) {
if (!caps.nodes['Sys.Console']) {
return false;
}
},
itemdblclick: run_editor itemdblclick: run_editor
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment