vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit fb4e6bab14f5da3fa6818a9dfd34449b7ff17f28
parent 9eaa9c1a17a2ee32655e2ac4868e775cd57976c7
Author: Miroslav Prasil <miroslav@prasil.info>
Date:   Mon,  1 Oct 2018 15:59:10 +0100

Clean up the share_collection handling

Diffstat:
Msrc/api/core/ciphers.rs | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs @@ -430,16 +430,12 @@ fn share_cipher_by_uuid(uuid: &str, data: ShareCipherData, headers: &Headers, co Some(organization_uuid) => { let mut shared_to_collection = false; for uuid in &data.CollectionIds { - match Collection::find_by_uuid(uuid, &conn) { + match Collection::find_by_uuid_and_org(uuid, &organization_uuid, &conn) { None => err!("Invalid collection ID provided"), Some(collection) => { if collection.is_writable_by_user(&headers.user.uuid, &conn) { - if collection.org_uuid == organization_uuid { - CollectionCipher::save(&cipher.uuid.clone(), &collection.uuid, &conn); - shared_to_collection = true; - } else { - err!("Collection does not belong to organization") - } + CollectionCipher::save(&cipher.uuid.clone(), &collection.uuid, &conn); + shared_to_collection = true; } else { err!("No rights to modify the collection") }