public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-network 3/3] api: fabrics: check node permissions with the node name in list_nodes
Date: Fri, 20 Nov 2026 16:22:46 +0100	[thread overview]
Message-ID: <20261120152251.265831-4-g.goller@proxmox.com> (raw)
In-Reply-To: <20261120152251.265831-1-g.goller@proxmox.com>

With the proxmox-perl-rs commit "pve-rs: fabrics: list nodes of all
fabrics", list_nodes() keys the nodes by section ID (<fabric>_<node>)
instead of the node name. Like for GET /cluster/sdn/fabrics/all, the
key can then no longer be used for the node permission check.

New nodes in a pending config only have node_id and fabric_id below
'pending'.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Fabrics/Node.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Fabrics/Node.pm b/src/PVE/API2/Network/SDN/Fabrics/Node.pm
index 851c8b1230fc..1141c6030b9e 100644
--- a/src/PVE/API2/Network/SDN/Fabrics/Node.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics/Node.pm
@@ -93,9 +93,10 @@ __PACKAGE__->register_method({
 
         my @res;
 
-        for my $node_id (keys %$nodes) {
-            my $node = $nodes->{$node_id};
-            my $fabric_id = $node->{fabric_id};
+        for my $id (keys %$nodes) {
+            my $node = $nodes->{$id};
+            my $fabric_id = $node->{fabric_id} // $node->{pending}->{fabric_id};
+            my $node_id = $node->{node_id} // $node->{pending}->{node_id};
 
             next if !$rpcenv->check_any($authuser, "/sdn/fabrics/$fabric_id", $fabric_privs, 1);
             next if !$rpcenv->check_any($authuser, "/nodes/$node_id", $node_privs, 1);
-- 
2.47.3





      parent reply	other threads:[~2026-11-20 15:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 15:22 [PATCH network/proxmox-perl-rs 0/3] Fix listing fabric nodes of hosts in multiple fabrics Gabriel Goller
2026-11-20 15:22 ` [PATCH proxmox-perl-rs 1/3] pve-rs: fabrics: list nodes of all fabrics Gabriel Goller
2026-11-20 15:22 ` [PATCH pve-network 2/3] api: fabrics: check node permissions with the node name in list_all Gabriel Goller
2026-11-20 15:22 ` Gabriel Goller [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=20261120152251.265831-4-g.goller@proxmox.com \
    --to=g.goller@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