From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D4DD020EC89 for ; Tue, 23 Apr 2024 14:00:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EB68830E85; Tue, 23 Apr 2024 14:00:26 +0200 (CEST) From: Lukas Wagner To: pbs-devel@lists.proxmox.com Date: Tue, 23 Apr 2024 13:52:30 +0200 Message-Id: <20240423115230.170113-45-l.wagner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240423115230.170113-1-l.wagner@proxmox.com> References: <20240423115230.170113-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.147 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mod.rs] Subject: [pbs-devel] [PATCH proxmox-backup v5 44/44] api: notification: also list datastores if user has only Backup privs X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Use the /admin/datatore API instead of /config/datastore to get a list of all available datastores - this ensures that users can see datastores even if they only have Datastore.Backup privs. Signed-off-by: Lukas Wagner --- src/api2/config/notifications/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api2/config/notifications/mod.rs b/src/api2/config/notifications/mod.rs index 48fa60b4..dfe82ed0 100644 --- a/src/api2/config/notifications/mod.rs +++ b/src/api2/config/notifications/mod.rs @@ -3,17 +3,17 @@ use serde::Serialize; use serde_json::Value; use std::cmp::Ordering; -use proxmox_router::{list_subdirs_api_method, Permission, RpcEnvironment}; +use proxmox_router::{list_subdirs_api_method, ApiMethod, Permission, RpcEnvironment}; use proxmox_router::{Router, SubdirMap}; use proxmox_schema::api; use proxmox_sortable_macro::sortable; +use crate::api2::admin::datastore::get_datastore_list; use pbs_api_types::PRIV_SYS_AUDIT; use crate::api2::admin::prune::list_prune_jobs; use crate::api2::admin::sync::list_sync_jobs; use crate::api2::admin::verify::list_verification_jobs; -use crate::api2::config::datastore::list_datastores; use crate::api2::config::media_pool::list_pools; use crate::api2::tape::backup::list_tape_backup_jobs; @@ -112,16 +112,17 @@ pub fn get_fields() -> Result, Error> { /// List all known, matchable metadata field values. pub fn get_values( param: Value, + info: &ApiMethod, rpcenv: &mut dyn RpcEnvironment, ) -> Result, Error> { let mut values = Vec::new(); - let datastores = list_datastores(param.clone(), rpcenv)?; + let datastores = get_datastore_list(param.clone(), info, rpcenv)?; for datastore in datastores { values.push(MatchableValue { field: "datastore".into(), - value: datastore.name.clone(), + value: datastore.store.clone(), comment: datastore.comment.clone(), }); } -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel