mirror of
https://github.com/dani-garcia/vaultwarden
synced 2024-11-12 13:01:51 +01:00
Error on invalid collection ID in post_collections_admin
This commit is contained in:
parent
e5c9d19e25
commit
9cf449e1c5
1 changed files with 3 additions and 1 deletions
|
@ -322,7 +322,7 @@ fn post_collections_admin(uuid: String, data: Json<CollectionsAdminData>, header
|
||||||
|
|
||||||
for collection in posted_collections.symmetric_difference(¤t_collections) {
|
for collection in posted_collections.symmetric_difference(¤t_collections) {
|
||||||
match Collection::find_by_uuid(&collection, &conn) {
|
match Collection::find_by_uuid(&collection, &conn) {
|
||||||
None => (), // Does not exist, what now?
|
None => err!("Invalid collection ID provided"),
|
||||||
Some(collection) => {
|
Some(collection) => {
|
||||||
if collection.is_writable_by_user(&headers.user.uuid, &conn) {
|
if collection.is_writable_by_user(&headers.user.uuid, &conn) {
|
||||||
if posted_collections.contains(&collection.uuid) { // Add to collection
|
if posted_collections.contains(&collection.uuid) { // Add to collection
|
||||||
|
@ -330,6 +330,8 @@ fn post_collections_admin(uuid: String, data: Json<CollectionsAdminData>, header
|
||||||
} else { // Remove from collection
|
} else { // Remove from collection
|
||||||
CollectionCipher::delete(&cipher.uuid, &collection.uuid, &conn);
|
CollectionCipher::delete(&cipher.uuid, &collection.uuid, &conn);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
err!("No rights to modify the collection")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue