File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 17
17
//! [zbus's blocking documentation]: https://docs.rs/zbus/latest/zbus/blocking/index.html
18
18
//! [async `SecretService`]: crate::SecretService
19
19
20
- use crate :: proxy:: service:: ServiceProxyBlocking ;
21
20
use crate :: session:: Session ;
22
21
use crate :: ss:: SS_COLLECTION_LABEL ;
23
22
use crate :: util;
23
+ use crate :: { proxy:: service:: ServiceProxyBlocking , util:: exec_prompt_blocking} ;
24
24
use crate :: { EncryptionType , Error , SearchItemsResult } ;
25
25
use std:: collections:: HashMap ;
26
26
use zbus:: zvariant:: { ObjectPath , Value } ;
@@ -178,6 +178,18 @@ impl<'a> SecretService<'a> {
178
178
locked : object_paths_to_items ( items. locked ) ?,
179
179
} )
180
180
}
181
+
182
+ /// Unlock all items in a batch
183
+ pub fn unlock_all ( & self , items : & [ & Item < ' _ > ] ) -> Result < ( ) , Error > {
184
+ let objects = items. iter ( ) . map ( |i| & * i. item_path ) . collect ( ) ;
185
+ let lock_action_res = self . service_proxy . unlock ( objects) ?;
186
+
187
+ if lock_action_res. object_paths . is_empty ( ) {
188
+ exec_prompt_blocking ( self . conn . clone ( ) , & lock_action_res. prompt ) ?;
189
+ }
190
+
191
+ Ok ( ( ) )
192
+ }
181
193
}
182
194
183
195
#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -326,6 +326,18 @@ impl<'a> SecretService<'a> {
326
326
. collect :: < Result < _ , _ > > ( ) ?,
327
327
} )
328
328
}
329
+
330
+ /// Unlock all items in a batch
331
+ pub async fn unlock_all ( & self , items : & [ & Item < ' _ > ] ) -> Result < ( ) , Error > {
332
+ let objects = items. iter ( ) . map ( |i| & * i. item_path ) . collect ( ) ;
333
+ let lock_action_res = self . service_proxy . unlock ( objects) . await ?;
334
+
335
+ if lock_action_res. object_paths . is_empty ( ) {
336
+ exec_prompt ( self . conn . clone ( ) , & lock_action_res. prompt ) . await ?;
337
+ }
338
+
339
+ Ok ( ( ) )
340
+ }
329
341
}
330
342
331
343
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments