public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Jonas Theisen <j.theisen@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 2/5] ui: align VM context menu to permissions
Date: Wed, 16 Sep 2026 11:06:56 +0200	[thread overview]
Message-ID: <20260916090715.72307-3-j.theisen@proxmox.com> (raw)
In-Reply-To: <20260916090715.72307-1-j.theisen@proxmox.com>

This patch better aligns the VM context / command menu
to the users permissions by hiding commands which are not available.

This is similar to what is already being done on the VM status page.

Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
 www/manager6/qemu/CmdMenu.js | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index df6045bf..54ab86b1 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -60,41 +60,43 @@ Ext.define('PVE.qemu.CmdMenu', {
             {
                 text: gettext('Start'),
                 iconCls: 'fa fa-fw fa-play',
-                hidden: running || suspended,
-                disabled: running || suspended,
+                hidden: running || suspended || !caps.vms['VM.PowerMgmt'],
+                disabled: running || suspended || !caps.vms['VM.PowerMgmt'],
                 handler: () => vm_command('start'),
             },
             {
                 text: gettext('Pause'),
                 iconCls: 'fa fa-fw fa-pause',
-                hidden: stopped || suspended,
-                disabled: stopped || suspended,
+                hidden: stopped || suspended || !caps.vms['VM.PowerMgmt'],
+                disabled: stopped || suspended || !caps.vms['VM.PowerMgmt'],
                 handler: () => confirmedVMCommand('suspend', undefined, 'qmpause'),
             },
             {
                 text: gettext('Hibernate'),
                 iconCls: 'fa fa-fw fa-download',
-                hidden: stopped || suspended,
-                disabled: stopped || suspended,
+                hidden: stopped || suspended || !caps.vms['VM.PowerMgmt'],
+                disabled: stopped || suspended || !caps.vms['VM.PowerMgmt'],
                 tooltip: gettext('Suspend to disk'),
                 handler: () => confirmedVMCommand('suspend', { todisk: 1 }),
             },
             {
                 text: gettext('Resume'),
                 iconCls: 'fa fa-fw fa-play',
-                hidden: !suspended,
+                hidden: !suspended || !caps.vms['VM.PowerMgmt'],
                 handler: () => vm_command('resume'),
             },
             {
                 text: gettext('Shutdown'),
                 iconCls: 'fa fa-fw fa-power-off',
-                disabled: stopped || suspended,
+                disabled: stopped || suspended || !caps.vms['VM.PowerMgmt'],
+                hidden: !caps.vms['VM.PowerMgmt'],
                 handler: () => confirmedVMCommand('shutdown'),
             },
             {
                 text: gettext('Stop'),
                 iconCls: 'fa fa-fw fa-stop',
-                disabled: stopped,
+                disabled: stopped || !caps.vms['VM.PowerMgmt'],
+                hidden: !caps.vms['VM.PowerMgmt'],
                 tooltip: Ext.String.format(gettext('Stop {0} immediately'), 'VM'),
                 handler: () => {
                     Ext.create('PVE.GuestStop', {
@@ -107,14 +109,16 @@ Ext.define('PVE.qemu.CmdMenu', {
             {
                 text: gettext('Reboot'),
                 iconCls: 'fa fa-fw fa-refresh',
-                disabled: stopped,
+                disabled: stopped || !(caps.vms['VM.Reboot'] || caps.vms['VM.PowerMgmt']),
+                hidden: !(caps.vms['VM.Reboot'] || caps.vms['VM.PowerMgmt']),
                 tooltip: Ext.String.format(gettext('Reboot {0}'), 'VM'),
                 handler: () => confirmedVMCommand('reboot'),
             },
             {
                 text: gettext('Reset'),
                 iconCls: 'fa fa-fw fa-bolt',
-                disabled: stopped,
+                disabled: stopped || !(caps.vms['VM.Reboot'] || caps.vms['VM.PowerMgmt']),
+                hidden: !(caps.vms['VM.Reboot'] || caps.vms['VM.PowerMgmt']),
                 tooltip: Ext.String.format(gettext('Reset {0}'), 'VM'),
                 handler: () => confirmedVMCommand('reset'),
             },
-- 
2.47.3





  parent reply	other threads:[~2026-09-16  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  9:06 [PATCH access-control/docs/manager/qemu-server 0/5] Add new permission VM.Reboot Jonas Theisen
2026-09-16  9:06 ` [PATCH manager 1/5] ui: integrate new VM.Reboot permission Jonas Theisen
2026-09-16  9:06 ` Jonas Theisen [this message]
2026-09-16  9:06 ` [PATCH access-control 3/5] acl: Add new privilege VM.Reboot Jonas Theisen
2026-09-16  9:06 ` [PATCH qemu-server 4/5] api: Integrate " Jonas Theisen
2026-09-16  9:06 ` [PATCH docs 5/5] pveum: VM permissions: add VM.Reboot Jonas Theisen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260916090715.72307-3-j.theisen@proxmox.com \
    --to=j.theisen@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal