Browse Source

fix: format

pull/6017/head
Richy 2 weeks ago
committed by Richy
parent
commit
e27941122c
  1. 13
      src/api/core/ciphers.rs

13
src/api/core/ciphers.rs

@ -1924,11 +1924,11 @@ impl CipherSyncData {
// Generate a HashMap with the collections_uuid as key and the CollectionGroup record // Generate a HashMap with the collections_uuid as key and the CollectionGroup record
let user_collections_groups: HashMap<CollectionId, CollectionGroup> = if CONFIG.org_groups_enabled() { let user_collections_groups: HashMap<CollectionId, CollectionGroup> = if CONFIG.org_groups_enabled() {
CollectionGroup::find_by_user(user_id, conn) CollectionGroup::find_by_user(user_id, conn).await.into_iter().fold(
.await HashMap::new(),
.into_iter() |mut combined_permissions, cg| {
.fold(HashMap::new(), |mut combined_permissions, cg| { combined_permissions
combined_permissions.entry(cg.collections_uuid.clone()) .entry(cg.collections_uuid.clone())
.and_modify(|existing| { .and_modify(|existing| {
// Combine permissions: take the most permissive settings. // Combine permissions: take the most permissive settings.
existing.read_only &= cg.read_only; // false if ANY group allows write existing.read_only &= cg.read_only; // false if ANY group allows write
@ -1937,7 +1937,8 @@ impl CipherSyncData {
}) })
.or_insert(cg); .or_insert(cg);
combined_permissions combined_permissions
}) },
)
} else { } else {
HashMap::new() HashMap::new()
}; };

Loading…
Cancel
Save