mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-16 10:57:37 +00:00
ui: improve permission handling for hardware
qemu/HardwareView: with the new Hardware privileges, we want to adapt a few places where we now allow to show the add/edit window with those permissions. form/{PCI,USB}Selector: increase the minHeight property of the PCI/USBSelector, so that the user can see the error message if he has not enough permissions. data/PermPathStore: add '/hardware' to the list of acl paths Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
02f14aa838
commit
7becf34fdd
@ -8,6 +8,7 @@ Ext.define('PVE.data.PermPathStore', {
|
|||||||
{ 'value': '/access' },
|
{ 'value': '/access' },
|
||||||
{ 'value': '/access/groups' },
|
{ 'value': '/access/groups' },
|
||||||
{ 'value': '/access/realm' },
|
{ 'value': '/access/realm' },
|
||||||
|
{ 'value': '/mapping' },
|
||||||
{ 'value': '/nodes' },
|
{ 'value': '/nodes' },
|
||||||
{ 'value': '/pool' },
|
{ 'value': '/pool' },
|
||||||
{ 'value': '/sdn/zones' },
|
{ 'value': '/sdn/zones' },
|
||||||
|
@ -22,6 +22,7 @@ Ext.define('PVE.form.PCISelector', {
|
|||||||
onLoadCallBack: undefined,
|
onLoadCallBack: undefined,
|
||||||
|
|
||||||
listConfig: {
|
listConfig: {
|
||||||
|
minHeight: 80,
|
||||||
width: 800,
|
width: 800,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,7 @@ Ext.define('PVE.form.USBSelector', {
|
|||||||
store: store,
|
store: store,
|
||||||
emptyText: emptyText,
|
emptyText: emptyText,
|
||||||
listConfig: {
|
listConfig: {
|
||||||
|
minHeight: 80,
|
||||||
width: 520,
|
width: 520,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -259,8 +259,8 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
group: 25,
|
group: 25,
|
||||||
order: i,
|
order: i,
|
||||||
iconCls: 'usb',
|
iconCls: 'usb',
|
||||||
editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.USBEdit' : undefined,
|
editor: caps.nodes['Sys.Console'] || caps.mapping['Mapping.Use'] ? 'PVE.qemu.USBEdit' : undefined,
|
||||||
never_delete: !caps.nodes['Sys.Console'],
|
never_delete: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'],
|
||||||
header: gettext('USB Device') + ' (' + confid + ')',
|
header: gettext('USB Device') + ' (' + confid + ')',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -270,8 +270,8 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
group: 30,
|
group: 30,
|
||||||
order: i,
|
order: i,
|
||||||
tdCls: 'pve-itype-icon-pci',
|
tdCls: 'pve-itype-icon-pci',
|
||||||
never_delete: !caps.nodes['Sys.Console'],
|
never_delete: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'],
|
||||||
editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.PCIEdit' : undefined,
|
editor: caps.nodes['Sys.Console'] || caps.mapping['Mapping.Use'] ? 'PVE.qemu.PCIEdit' : undefined,
|
||||||
header: gettext('PCI Device') + ' (' + confid + ')',
|
header: gettext('PCI Device') + ' (' + confid + ')',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -577,14 +577,15 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
|
|
||||||
// heuristic only for disabling some stuff, the backend has the final word.
|
// heuristic only for disabling some stuff, the backend has the final word.
|
||||||
const noSysConsolePerm = !caps.nodes['Sys.Console'];
|
const noSysConsolePerm = !caps.nodes['Sys.Console'];
|
||||||
|
const noHWPerm = !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'];
|
||||||
const noVMConfigHWTypePerm = !caps.vms['VM.Config.HWType'];
|
const noVMConfigHWTypePerm = !caps.vms['VM.Config.HWType'];
|
||||||
const noVMConfigNetPerm = !caps.vms['VM.Config.Network'];
|
const noVMConfigNetPerm = !caps.vms['VM.Config.Network'];
|
||||||
const noVMConfigDiskPerm = !caps.vms['VM.Config.Disk'];
|
const noVMConfigDiskPerm = !caps.vms['VM.Config.Disk'];
|
||||||
const noVMConfigCDROMPerm = !caps.vms['VM.Config.CDROM'];
|
const noVMConfigCDROMPerm = !caps.vms['VM.Config.CDROM'];
|
||||||
const noVMConfigCloudinitPerm = !caps.vms['VM.Config.Cloudinit'];
|
const noVMConfigCloudinitPerm = !caps.vms['VM.Config.Cloudinit'];
|
||||||
|
|
||||||
me.down('#addUsb').setDisabled(noSysConsolePerm || isAtUsbLimit());
|
me.down('#addUsb').setDisabled(noHWPerm || isAtUsbLimit());
|
||||||
me.down('#addPci').setDisabled(noSysConsolePerm || isAtLimit('hostpci'));
|
me.down('#addPci').setDisabled(noHWPerm || isAtLimit('hostpci'));
|
||||||
me.down('#addAudio').setDisabled(noVMConfigHWTypePerm || isAtLimit('audio'));
|
me.down('#addAudio').setDisabled(noVMConfigHWTypePerm || isAtLimit('audio'));
|
||||||
me.down('#addSerial').setDisabled(noVMConfigHWTypePerm || isAtLimit('serial'));
|
me.down('#addSerial').setDisabled(noVMConfigHWTypePerm || isAtLimit('serial'));
|
||||||
me.down('#addNet').setDisabled(noVMConfigNetPerm || isAtLimit('net'));
|
me.down('#addNet').setDisabled(noVMConfigNetPerm || isAtLimit('net'));
|
||||||
@ -697,14 +698,14 @@ Ext.define('PVE.qemu.HardwareView', {
|
|||||||
text: gettext('USB Device'),
|
text: gettext('USB Device'),
|
||||||
itemId: 'addUsb',
|
itemId: 'addUsb',
|
||||||
iconCls: 'fa fa-fw fa-usb black',
|
iconCls: 'fa fa-fw fa-usb black',
|
||||||
disabled: !caps.nodes['Sys.Console'],
|
disabled: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'],
|
||||||
handler: editorFactory('USBEdit'),
|
handler: editorFactory('USBEdit'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: gettext('PCI Device'),
|
text: gettext('PCI Device'),
|
||||||
itemId: 'addPci',
|
itemId: 'addPci',
|
||||||
iconCls: 'pve-itype-icon-pci',
|
iconCls: 'pve-itype-icon-pci',
|
||||||
disabled: !caps.nodes['Sys.Console'],
|
disabled: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'],
|
||||||
handler: editorFactory('PCIEdit'),
|
handler: editorFactory('PCIEdit'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user