From 69d2eb953dd31dd0fbc73cf32d2ad1dd10a9e0f4 Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Thu, 20 Jul 2023 16:32:02 +0200 Subject: [PATCH] notify: add wrapper for `get_referenced_entities` 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 --- 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, ApiError> { + let config = this.config.lock().unwrap(); + api::common::get_referenced_entities(&config, name) + } }