From: David Riley <d.riley@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-access-control v5 1/7] permission: add acl tree node parent lookup without node creation
Date: Thu, 16 Jul 2026 09:31:41 +0200 [thread overview]
Message-ID: <8434fa22-ec2a-4ba3-9ce5-6a3a7511708f@proxmox.com> (raw)
In-Reply-To: <09b9d739-9bc1-4eea-b5fc-c5bbb6118686@proxmox.com>
On 7/15/26 5:00 PM, Stefan Hanreich wrote:
> On 7/7/26 2:05 PM, David Riley wrote:
>> Add helper function to look up ACL nodes by path without creating
>> missing nodes along the path. This is necessary for safely locating
>> paths intended for deletion or migration without side effects.
>>
>> This is in preparation for the following SDN resource ACL pruning and
>> VNet migration changes.
>>
>> Signed-off-by: David Riley <d.riley@proxmox.com>
>> ---
>> src/PVE/AccessControl.pm | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/src/PVE/AccessControl.pm b/src/PVE/AccessControl.pm
>> index 0d632b3..e26dfce 100644
>> --- a/src/PVE/AccessControl.pm
>> +++ b/src/PVE/AccessControl.pm
>> @@ -1000,6 +1000,31 @@ sub find_acl_tree_node {
>> return $node;
>> }
>>
>> +# finds an ACL node by path without autovivifying (creating) missing
>> +# nodes. returns a list containing the parent node, the final path
>> +# segment, and the target node itself.
> Max worked on an RFC [1] on how to document Perl code, which employs
> POD, might be worthwhile to read up on it and write newer documentation
> in that style.
>
> [1] https://wiki.intra.proxmox.com/Perl_Documentation
Thanks for the heads up I'll read up on it.
>> +sub find_acl_tree_node_parent {
>> + my ($root, $path) = @_;
>> +
>> + my $current = $root;
>> + my $parent = undef;
>> + my $last_key = undef;
>> +
>> + my @split_path = split('/', $path);
>> +
>> + for my $segment (@split_path) {
>> + if (defined($current->{children}) && defined($current->{children}->{$segment})) {
>> + $parent = $current;
>> + $last_key = $segment;
>> + $current = $current->{children}->{$segment};
>> + } else {
>> + return (undef, undef, undef);
>> + }
>> + }
>> +
>> + return ($parent, $last_key, $current);
>> +}
>> +
>> sub add_user_group {
>> my ($username, $usercfg, $group) = @_;
>>
>>
next prev parent reply other threads:[~2026-07-16 7:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 12:03 [PATCH access-control/network v5 0/7] fix #7520: sdn: prune orphaned ACLs and handle VNet migrations David Riley
2026-07-07 12:03 ` [PATCH pve-access-control v5 1/7] permission: add acl tree node parent lookup without node creation David Riley
2026-07-15 14:59 ` Stefan Hanreich
2026-07-16 7:31 ` David Riley [this message]
2026-07-07 12:03 ` [PATCH pve-access-control v5 2/7] fix #7520: sdn: add pruning SDN resources ACLs David Riley
2026-07-07 12:04 ` [PATCH pve-access-control v5 3/7] test: add sdn acl pruning tests David Riley
2026-07-16 7:32 ` Daniel Kral
2026-07-16 8:05 ` David Riley
2026-07-07 12:04 ` [PATCH pve-access-control v5 4/7] permission: add helper to check for active permissions David Riley
2026-07-07 12:04 ` [PATCH pve-access-control v5 5/7] fix #7520: sdn: add VNet ACL migration David Riley
2026-07-15 14:59 ` Stefan Hanreich
2026-07-16 7:25 ` David Riley
2026-07-07 12:04 ` [PATCH pve-access-control v5 6/7] test: add sdn acl migration tests David Riley
2026-07-07 12:04 ` [PATCH pve-network v5 7/7] fix #7520: config: prune orphaned and relocate moved VNet ACLs David Riley
2026-07-15 15:00 ` Stefan Hanreich
2026-07-16 7:11 ` David Riley
2026-07-15 15:11 ` [PATCH access-control/network v5 0/7] fix #7520: sdn: prune orphaned ACLs and handle VNet migrations Stefan Hanreich
2026-07-16 10:47 ` superseded: " David Riley
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=8434fa22-ec2a-4ba3-9ce5-6a3a7511708f@proxmox.com \
--to=d.riley@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.hanreich@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