public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox v3 2/5] access-control: use format strings where possible
Date: Thu,  6 Nov 2025 15:38:28 +0100	[thread overview]
Message-ID: <20251106143836.288888-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251106143836.288888-1-s.sterz@proxmox.com>

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 proxmox-access-control/src/acl.rs | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/proxmox-access-control/src/acl.rs b/proxmox-access-control/src/acl.rs
index 7813ea5d..f2589e57 100644
--- a/proxmox-access-control/src/acl.rs
+++ b/proxmox-access-control/src/acl.rs
@@ -335,7 +335,7 @@ impl AclTree {
         for user_or_group in &uglist {
             for role in &rolelist {
                 if !access_conf().roles().contains_key(role) {
-                    bail!("unknown role '{}'", role);
+                    bail!("unknown role '{role}'");
                 }
                 if let Some(group) = user_or_group.strip_prefix('@') {
                     node.insert_group_role(group.to_string(), role.to_string(), propagate);
@@ -358,9 +358,8 @@ impl AclTree {
             }
             if let Err(err) = tree.parse_acl_line(line) {
                 bail!(
-                    "unable to parse acl config data, line {} - {}",
+                    "unable to parse acl config data, line {} - {err}",
                     linenr + 1,
-                    err
                 );
             }
         }
@@ -493,10 +492,8 @@ impl AclTree {
             let role_list = role_list(roles);
             writeln!(
                 w,
-                "acl:0:{}:{}:{}",
+                "acl:0:{}:{uglist}:{role_list}",
                 if path.is_empty() { "/" } else { path },
-                uglist,
-                role_list
             )?;
         }
 
@@ -504,10 +501,8 @@ impl AclTree {
             let role_list = role_list(roles);
             writeln!(
                 w,
-                "acl:1:{}:{}:{}",
+                "acl:1:{}:{uglist}:{role_list}",
                 if path.is_empty() { "/" } else { path },
-                uglist,
-                role_list
             )?;
         }
 
@@ -532,7 +527,7 @@ impl AclTree {
                 if err.kind() == std::io::ErrorKind::NotFound {
                     String::new()
                 } else {
-                    bail!("unable to read acl config {:?} - {}", filename, err);
+                    bail!("unable to read acl config {filename:?} - {err}");
                 }
             }
         };
@@ -546,10 +541,8 @@ impl AclTree {
             }
             if let Err(err) = tree.parse_acl_line(line) {
                 bail!(
-                    "unable to parse acl config {:?}, line {} - {}",
-                    filename,
-                    linenr + 1,
-                    err
+                    "unable to parse acl config {filename:?}, line {} - {err}",
+                    linenr + 1
                 );
             }
         }
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-11-06 14:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 14:38 [pdm-devel] [PATCH datacenter-manager/proxmox/yew-comp v3 00/10] add support for checking acl permissions in (yew) front-ends Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH proxmox v3 1/5] access-control: add acl feature to only expose types and the AclTree Shannon Sterz
2025-11-06 14:38 ` Shannon Sterz [this message]
2025-11-06 14:38 ` [pdm-devel] [PATCH proxmox v3 3/5] access-control: move functions querying privileges to " Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH proxmox v3 4/5] access-control: derive Debug and PartialEq on AclTree and AclTreeNode Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH proxmox v3 5/5] access-control: allow reading all acls of the current authid Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH yew-comp v3 1/2] acl_context: add AclContext and AclContextProvider Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH yew-comp v3 2/2] http_helpers: reload LocalAclTree when logging in or refreshing a ticket Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH datacenter-manager v3 1/3] server/api-types: move AccessControlConfig to shared api types Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH datacenter-manager v3 2/3] ui: add an AclContext via the AclContextProvider to the main app ui Shannon Sterz
2025-11-06 14:38 ` [pdm-devel] [PATCH datacenter-manager v3 3/3] ui: main menu: use the AclContext to hide the Notes if appropriate Shannon Sterz

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=20251106143836.288888-3-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pdm-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