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', {
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
}
});
......
......@@ -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
}
});
......
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