From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id DEFAD6C6E5 for ; Sat, 7 Aug 2021 18:00:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CED4616C8D for ; Sat, 7 Aug 2021 18:00:24 +0200 (CEST) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6118A16C76 for ; Sat, 7 Aug 2021 18:00:23 +0200 (CEST) Received: by mail-wr1-x42f.google.com with SMTP id h14so15197529wrx.10 for ; Sat, 07 Aug 2021 09:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=odiso-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version; bh=75gTwCCEVNc4qid3YW64NACOcw9bO+ZYt0l50CHovX8=; b=D0b59GsCOBlevWOH/9UAG7DBxI/NVlp0Qa1OXkyutL5u7IABIZK81LgXvIe6kk+3RI pKTydbOqpHaBr9ee1cIsKVGv6B7kMm4LYUgAzwKBVKnNQzNkalshdzvEju0bLHzbTwgK rShGa6WZzuvhDooC1qhOI5YD+hOTDf7Cxc1sS1Rh3ghgv3r9myHwfZiDvg91/cKyWK/9 ZOCoT75s5idbiA9IW71weiis6P4JKg30lwq0/JjvnH2KKmof/0+IXoRdvT+7ho9CNDXV 8+3XGFFjb/yc9WegOHoI5NZdIF+ipguO2PgOWrflLHSfijaZ2tyhOUVPptqUyfb966ax /Clg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version; bh=75gTwCCEVNc4qid3YW64NACOcw9bO+ZYt0l50CHovX8=; b=dq4APjfKdrK5YLsK1U+hwIWBLma3O8N3CLlSCq6oUkCwm2gjvKPKSphjNDNU0yCwT1 qXBcIEe0R9VxzLqRasfH7Rq9gplOzK2UnpGR9AlgJgiRHVx5FSwdxq7GJiFQ0MReAvqV fjYOALawFDWfrz6pydwncOyvUB1paX6QizUIJ7A8fQGxxiOj38U2hPZrOA5+fYL2uHsj 4pa4Hi0U1l030JLdQZZvPb5JdHvsw6y2bq8/iK5ApWu62bUMk48+jYGmQmVe9KEtGeQY 2c1yYcNKo0M521xSnuuZi3ucjKHA2hm01dLZ/0nUm/P/Wk75RgkAzW5q2srlOiyXzFkd KNvw== X-Gm-Message-State: AOAM533a7n6hofBJwIpzvtD6uilUnj0Zth7zMUNXkBWiQG+gwL08mi9L dnRuMEz3DrG9SDDexpO4RB1Ce+NQoNoz+g== X-Google-Smtp-Source: ABdhPJzS2/eWhe9JA3C//gAb826akSxQMiymsvfSoMkoFcHyvIQWRnzBzHHy7Z5bfMquif3AIHzycQ== X-Received: by 2002:adf:f4d2:: with SMTP id h18mr3683664wrp.37.1628352016733; Sat, 07 Aug 2021 09:00:16 -0700 (PDT) Received: from [192.168.178.50] ([79.132.252.54]) by smtp.gmail.com with ESMTPSA id w1sm15235025wmc.19.2021.08.07.09.00.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Aug 2021 09:00:16 -0700 (PDT) Message-ID: <144f9c657d3786883f5ed178362323a6e018f6f0.camel@odiso.com> From: alexandre derumier To: pve-devel@lists.proxmox.com Date: Sat, 07 Aug 2021 18:00:14 +0200 In-Reply-To: <20210805145900.3265228-4-aderumier@odiso.com> References: <20210805145900.3265228-1-aderumier@odiso.com> <20210805145900.3265228-4-aderumier@odiso.com> User-Agent: Evolution 3.40.3 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.610 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature HTML_MESSAGE 0.001 HTML included in message POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [network.pm] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [pve-devel] [PATCH pve-manager 2/2] api2 : network: anybridge: don't display bridges if user have access to vnets. X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 16:00:24 -0000 Hi, abou this patch, I'm not sure it's the right way, a forum user request that also sdnadmin can view vmbrX. I don't known how to hide correctly vmbrX bridge, as currently , we don't have any permissions management, and I don't want to break current users setup. maybe could we add a special permission like "noaccess" with path like /bridge/vmbrX  ? (we currently have a role "noaccess", but it's simply a role without any permission. Le jeudi 05 août 2021 à 16:59 +0200, Alexandre Derumier a écrit : > This remove vmbr* from bridgeselector if user have access to vnets. > (as currently, we don't have have permission management on vmbr$) > > Signed-off-by: Alexandre Derumier > --- >  PVE/API2/Network.pm | 19 ++++++++++++------- >  1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm > index a26f36d2..02bd3bdb 100644 > --- a/PVE/API2/Network.pm > +++ b/PVE/API2/Network.pm > @@ -226,6 +226,7 @@ __PACKAGE__->register_method({ >         my ($param) = @_; >   >         my $rpcenv = PVE::RPCEnvironment::get(); > +       my $authuser = $rpcenv->get_user(); >   >         my $tmp = PVE::INotify::read_file('interfaces', 1); >         my $config = $tmp->{data}; > @@ -238,20 +239,24 @@ __PACKAGE__->register_method({ >         delete $ifaces->{lo}; # do not list the loopback device >   >         if ($param->{type}) { > +           my $vnets = {}; > +           my $filtered_sdn = undef; > +           if ($have_sdn && $param->{type} eq 'any_bridge') { > +               $vnets = PVE::Network::SDN::get_local_vnets(); > +               $filtered_sdn = 1 if $authuser ne 'root@pam' && keys > %{$vnets} > 0; > +           } > + >             foreach my $k (keys %$ifaces) { >                 my $type = $ifaces->{$k}->{type}; >                 my $match =  ($param->{type} eq $type) || ( >                     ($param->{type} eq 'any_bridge') && >                     ($type eq 'bridge' || $type eq 'OVSBridge')); > -               delete $ifaces->{$k} if !$match; > +               delete $ifaces->{$k} if !$match || $filtered_sdn; >             } >   > -           if ($have_sdn && $param->{type} eq 'any_bridge') { > -               my $vnets = PVE::Network::SDN::get_local_vnets(); > -               map { > -                   $ifaces->{$_} = $vnets->{$_}; > -               } keys %$vnets; > -           } > +           map { > +               $ifaces->{$_} = $vnets->{$_}; > +           } keys %$vnets; >         } >   >         return PVE::RESTHandler::hash_to_array($ifaces, 'iface');