mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 11:46:44 +00:00
ui: lxc options: disable features edit as non-root when container is privileged
The backend won't allow any edits in this case, so better just disable the edit button altogether. Co-developed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
8c4ec1aef8
commit
2bc71fd9c3
@ -136,8 +136,7 @@ Ext.define('PVE.lxc.Options', {
|
||||
features: {
|
||||
header: gettext('Features'),
|
||||
defaultValue: Proxmox.Utils.noneText,
|
||||
editor: Proxmox.UserName === 'root@pam' || caps.vms['VM.Allocate']
|
||||
? 'PVE.lxc.FeaturesEdit' : undefined,
|
||||
editor: 'PVE.lxc.FeaturesEdit',
|
||||
},
|
||||
hookscript: {
|
||||
header: gettext('Hookscript'),
|
||||
@ -174,7 +173,15 @@ Ext.define('PVE.lxc.Options', {
|
||||
var pending = rec.data.delete || me.hasPendingChanges(key);
|
||||
var rowdef = rows[key];
|
||||
|
||||
edit_btn.setDisabled(!rowdef.editor);
|
||||
if (key === 'features') {
|
||||
let unprivileged = me.getStore().getById('unprivileged').data.value;
|
||||
let root = Proxmox.UserName === 'root@pam';
|
||||
let vmalloc = caps.vms['VM.Allocate'];
|
||||
edit_btn.setDisabled(!(root || (vmalloc && unprivileged)));
|
||||
} else {
|
||||
edit_btn.setDisabled(!rowdef.editor);
|
||||
}
|
||||
|
||||
revert_btn.setDisabled(!pending);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user