From 7dfc7596912b4a83253accb1e941f145ef9c3ae9 Mon Sep 17 00:00:00 2001 From: Kumar Ankur Date: Fri, 3 Aug 2018 19:23:27 +0530 Subject: [PATCH 1/2] Implmeneted DELETE on 'api/ciphers' to delete selected ciphers (#98) --- src/api/core/ciphers.rs | 7 ++++++- src/api/core/mod.rs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 0c8b0a2f..95df5a00 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -461,7 +461,7 @@ fn delete_cipher(uuid: String, headers: Headers, conn: DbConn) -> EmptyResult { _delete_cipher_by_uuid(&uuid, &headers, &conn) } -#[post("/ciphers/delete", data = "")] +#[delete("/ciphers", data = "")] fn delete_cipher_selected(data: JsonUpcase, headers: Headers, conn: DbConn) -> EmptyResult { let data: Value = data.into_inner().data; @@ -482,6 +482,11 @@ fn delete_cipher_selected(data: JsonUpcase, headers: Headers, conn: DbCon Ok(()) } +#[post("/ciphers/delete", data = "")] +fn delete_cipher_selected_post(data: JsonUpcase, headers: Headers, conn: DbConn) -> EmptyResult { + delete_cipher_selected(data, headers, conn) +} + #[post("/ciphers/move", data = "")] fn move_cipher_selected(data: JsonUpcase, headers: Headers, conn: DbConn) -> EmptyResult { let data = data.into_inner().data; diff --git a/src/api/core/mod.rs b/src/api/core/mod.rs index 479318c5..0f07f606 100644 --- a/src/api/core/mod.rs +++ b/src/api/core/mod.rs @@ -47,6 +47,7 @@ pub fn routes() -> Vec { delete_cipher_post, delete_cipher_post_admin, delete_cipher, + delete_cipher_selected_post, delete_cipher_selected, delete_all, move_cipher_selected, From aac1304b46ccbba909369a74c142c2ef4c577eb5 Mon Sep 17 00:00:00 2001 From: Kumar Ankur Date: Fri, 3 Aug 2018 19:31:01 +0530 Subject: [PATCH 2/2] clean up --- src/api/core/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/core/mod.rs b/src/api/core/mod.rs index 0f07f606..e06c36b4 100644 --- a/src/api/core/mod.rs +++ b/src/api/core/mod.rs @@ -47,8 +47,8 @@ pub fn routes() -> Vec { delete_cipher_post, delete_cipher_post_admin, delete_cipher, - delete_cipher_selected_post, delete_cipher_selected, + delete_cipher_selected_post, delete_all, move_cipher_selected, move_cipher_selected_put,