[pve-devel] [PATCH v3 proxmox-perl-rs 33/66] notify: add wrapper for `get_referenced_entities`

Lukas Wagner l.wagner at proxmox.com
Mon Jul 17 17:00:18 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 0c00b03..d34ec85 100644
--- a/pve-rs/src/notify.rs
+++ b/pve-rs/src/notify.rs
@@ -543,4 +543,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