[pbs-devel] [PATCH proxmox v2 7/7] access-control: split crate in `default` and `impl` features
Shannon Sterz
s.sterz at proxmox.com
Thu Jun 13 14:52:36 CEST 2024
this way the types defined in this crate can be re-used in places
without necessarily having to use the ACL, token shadow and
(cached) user config implementations.
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
proxmox-access-control/Cargo.toml | 32 +++++++++++++++++++++----------
proxmox-access-control/src/lib.rs | 12 +++++++++++-
2 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/proxmox-access-control/Cargo.toml b/proxmox-access-control/Cargo.toml
index 239dcc91..8f50a074 100644
--- a/proxmox-access-control/Cargo.toml
+++ b/proxmox-access-control/Cargo.toml
@@ -14,17 +14,29 @@ description = "A collection of utilities to implement access control management.
[dependencies]
anyhow.workspace = true
-nix.workspace = true
-openssl.workspace = true
+nix = { workspace = true, optional = true }
+openssl = { workspace = true, optional = true }
serde.workspace = true
-serde_json.workspace = true
+serde_json = { workspace = true, optional = true }
-# proxmox-notify.workspace = true
proxmox-auth-api = { workspace = true, features = [ "api-types" ] }
-proxmox-router = { workspace = true }
+proxmox-router = { workspace = true, optional = true }
proxmox-schema.workspace = true
-proxmox-section-config.workspace = true
-proxmox-product-config.workspace = true
-proxmox-shared-memory.workspace = true
-proxmox-sys = { workspace = true, features = [ "crypt" ] }
-proxmox-time.workspace = true
+proxmox-section-config = { workspace = true, optional = true }
+proxmox-product-config = { workspace = true, optional = true }
+proxmox-shared-memory = { workspace = true, optional = true }
+proxmox-sys = { workspace = true, features = [ "crypt" ], optional = true }
+proxmox-time = { workspace = true }
+
+[features]
+default = []
+impl = [
+ "dep:nix",
+ "dep:openssl",
+ "dep:proxmox-product-config",
+ "dep:proxmox-router",
+ "dep:proxmox-section-config",
+ "dep:proxmox-shared-memory",
+ "dep:proxmox-sys",
+ "dep:serde_json",
+]
diff --git a/proxmox-access-control/src/lib.rs b/proxmox-access-control/src/lib.rs
index 16132072..7fabcfb5 100644
--- a/proxmox-access-control/src/lib.rs
+++ b/proxmox-access-control/src/lib.rs
@@ -1,8 +1,18 @@
+pub mod types;
+
+#[cfg(feature = "impl")]
pub mod acl;
+
+#[cfg(feature = "impl")]
pub mod init;
+
+#[cfg(feature = "impl")]
pub mod token_shadow;
-pub mod types;
+
+#[cfg(feature = "impl")]
pub mod user;
+#[cfg(feature = "impl")]
mod cached_user_info;
+#[cfg(feature = "impl")]
pub use cached_user_info::CachedUserInfo;
--
2.39.2
More information about the pbs-devel
mailing list