[pdm-devel] [PATCH proxmox 2/4] access-control: add acl api feature

Dietmar Maurer dietmar at proxmox.com
Wed Apr 9 13:01:48 CEST 2025


> +/// Get ACL entries, can be filter by path.
> +pub fn read_acl(
> +    path: Option<String>,
> +    exact: bool,
> +    rpcenv: &mut dyn RpcEnvironment,
> +) -> Result<Vec<AclListItem>, Error> {
> +    let auth_id = rpcenv
> +        .get_auth_id()
> +        .ok_or_else(|| format_err!("endpoint called without an auth id"))?
> +        .parse()?;
> +
> +    let top_level_privs = CachedUserInfo::new()?.lookup_privs(&auth_id, &["access", "acl"]);
> +
> +    let filter = if top_level_privs & access_conf().acl_audit_privileges() == 0 {
> +        Some(auth_id)
> +    } else {
> +        None
> +    };

As discussed offline, maybe we can use CachedUserInfo::check_privs here?




More information about the pdm-devel mailing list