[pve-devel] [PATCH v4 proxmox-perl-rs 35/69] notify: add wrapper for `get_referenced_entities`

Lukas Wagner l.wagner at proxmox.com
Thu Jul 20 16:32:02 CEST 2023


The function returns all other entities referenced by a filter/target.
This is useful for permission checks, where the user must have the
appropriate permissions for all entities.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 pve-rs/src/notify.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/pve-rs/src/notify.rs b/pve-rs/src/notify.rs
index 5ab0ef5..f6d70d0 100644
--- a/pve-rs/src/notify.rs
+++ b/pve-rs/src/notify.rs
@@ -548,4 +548,13 @@ mod export {
         let mut config = this.config.lock().unwrap();
         api::filter::delete_filter(&mut config, name)
     }
+
+    #[export]
+    fn get_referenced_entities(
+        #[try_from_ref] this: &NotificationConfig,
+        name: &str,
+    ) -> Result<Vec<String>, ApiError> {
+        let config = this.config.lock().unwrap();
+        api::common::get_referenced_entities(&config, name)
+    }
 }
-- 
2.39.2






More information about the pve-devel mailing list