public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH proxmox-yew-comp 2/2] fix: user_panel: disable "remove" button if the user is "root"
Date: Fri, 12 Jun 2026 17:44:46 +0200	[thread overview]
Message-ID: <20260612154446.364072-3-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260612154446.364072-1-s.shaji@proxmox.com>

Earlier, the "Remove" button was enabled for the root user. To fix this,
add an addition check to disable the button if the user is root.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 src/user_panel.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/user_panel.rs b/src/user_panel.rs
index 6903b87..ae1b3a0 100644
--- a/src/user_panel.rs
+++ b/src/user_panel.rs
@@ -201,6 +201,9 @@ impl LoadableComponent for ProxmoxUserPanel {
                     .map(|p| p != user.user.userid.realm().as_str())
             })
             .unwrap_or(no_selection);
+        let is_root_user = selected_user
+            .as_ref()
+            .is_some_and(|user| user.user.userid.as_str() == "root@pam");
 
         let toolbar = Toolbar::new()
             .class("pwt-w-100")
@@ -219,7 +222,7 @@ impl LoadableComponent for ProxmoxUserPanel {
             .with_child(
                 ConfirmButton::new(tr!("Remove"))
                     .dangerous(true)
-                    .disabled(no_selection)
+                    .disabled(no_selection || is_root_user)
                     .confirm_message(match selected_user {
                         Some(user) => tr!(
                             "Are you sure you want to remove entry '{}'?",
-- 
2.47.3





      parent reply	other threads:[~2026-06-12 15:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 15:44 [PATCH proxmox-yew-comp 0/2] fix: user_panel: show confirmation dialog and disable remove button Shan Shaji
2026-06-12 15:44 ` [PATCH proxmox-yew-comp 1/2] fix: user_panel: show confirmation dialog before removing users Shan Shaji
2026-06-12 15:44 ` Shan Shaji [this message]

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=20260612154446.364072-3-s.shaji@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=yew-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