From 9cf449e1c529ab7b21f25729050b35ca39cbc4e9 Mon Sep 17 00:00:00 2001 From: Miroslav Prasil Date: Fri, 11 May 2018 11:45:55 +0100 Subject: [PATCH] Error on invalid collection ID in post_collections_admin --- src/api/core/ciphers.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 0afe760..d3d4717 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -322,7 +322,7 @@ fn post_collections_admin(uuid: String, data: Json, header for collection in posted_collections.symmetric_difference(¤t_collections) { match Collection::find_by_uuid(&collection, &conn) { - None => (), // Does not exist, what now? + None => err!("Invalid collection ID provided"), Some(collection) => { if collection.is_writable_by_user(&headers.user.uuid, &conn) { if posted_collections.contains(&collection.uuid) { // Add to collection @@ -330,6 +330,8 @@ fn post_collections_admin(uuid: String, data: Json, header } else { // Remove from collection CollectionCipher::delete(&cipher.uuid, &collection.uuid, &conn); } + } else { + err!("No rights to modify the collection") } } }