]> git.proxmox.com Git - proxmox-backup.git/commitdiff
hierachy: add lifetime to ListAccessibleBackupGroups so that owner can be ref
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 13 May 2022 14:48:56 +0000 (16:48 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 13 May 2022 14:48:56 +0000 (16:48 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/api2/admin/datastore.rs
src/backup/hierarchy.rs
src/backup/verify.rs

index a22c24447e0d2c1f6049567072471b6f932609e7..f7455c084003f4868e2d4befc9c5097173452243 100644 (file)
@@ -854,7 +854,7 @@ pub fn verify(
                 failed_dirs
             } else {
                 let owner = if owner_check_required {
-                    Some(auth_id)
+                    Some(&auth_id)
                 } else {
                     None
                 };
index 953ea4ceb1ac1d0619814f15e7c0a6d19445b89d..72e82c7b61e7d5f58f07af3901fee6a6eec2e450 100644 (file)
@@ -13,22 +13,22 @@ use pbs_datastore::{backup_info::BackupGroup, DataStore, ListGroups, ListNamespa
 ///
 /// Is basically just a filter-iter for pbs_datastore::ListNamespacesRecursive including access and
 /// optional owner checks.
-pub struct ListAccessibleBackupGroups {
+pub struct ListAccessibleBackupGroups<'a> {
     store: Arc<DataStore>,
-    auth_id: Option<Authid>,
+    auth_id: Option<&'a Authid>,
     user_info: Arc<CachedUserInfo>,
     state: Option<ListGroups>,
     ns_iter: ListNamespacesRecursive,
 }
 
-impl ListAccessibleBackupGroups {
+impl <'a> ListAccessibleBackupGroups<'a> {
     // TODO: builder pattern
 
     pub fn new(
         store: Arc<DataStore>,
         ns: BackupNamespace,
         max_depth: usize,
-        auth_id: Option<Authid>,
+        auth_id: Option<&'a Authid>,
     ) -> Result<Self, Error> {
         let ns_iter = ListNamespacesRecursive::new_max_depth(Arc::clone(&store), ns, max_depth)?;
         Ok(ListAccessibleBackupGroups {
@@ -41,7 +41,7 @@ impl ListAccessibleBackupGroups {
     }
 }
 
-impl Iterator for ListAccessibleBackupGroups {
+impl <'a> Iterator for ListAccessibleBackupGroups<'a> {
     type Item = Result<BackupGroup, Error>;
 
     fn next(&mut self) -> Option<Self::Item> {
index a5ec9a4c46b8ff9257ecee23fe875f1518c6960b..cf091e5ede6332d1e96836006ccc50f775db38fa 100644 (file)
@@ -498,7 +498,7 @@ pub fn verify_all_backups(
     upid: &UPID,
     ns: BackupNamespace,
     max_depth: Option<usize>,
-    owner: Option<Authid>,
+    owner: Option<&Authid>,
     filter: Option<&dyn Fn(&BackupManifest) -> bool>,
 ) -> Result<Vec<String>, Error> {
     let mut errors = Vec::new();