Browse Source

Account for removing existing collections first

pull/5838/head
Stephen 2 months ago
parent
commit
70676a9c23
  1. 4
      src/api/core/ciphers.rs

4
src/api/core/ciphers.rs

@ -783,6 +783,10 @@ async fn post_bulk_collections(
err!("Cipher is not write accessible")
}
// If the request is for mass adding collections, we need remove the cipher from all collections first.
if (!data.remove_collections) {
CollectionCipher::delete_all_by_cipher(&cipher.uuid, &mut conn).await?;
}
for collection in &data.collection_ids {
match Collection::find_by_uuid_and_org(collection, &data.organization_id, &mut conn).await {
None => err!("Invalid collection ID provided"),

Loading…
Cancel
Save