From 3cfdf9b5858b7c2e5c0868fc4bc42f9fd1a14f80 Mon Sep 17 00:00:00 2001 From: mprasil Date: Tue, 28 Aug 2018 23:48:53 +0100 Subject: [PATCH] Add DELETE handlers fo cipher and attachment deletion (fixes #158) (#160) --- src/api/core/ciphers.rs | 10 ++++++++++ src/api/core/mod.rs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index eefd167..21b01bb 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -520,6 +520,11 @@ fn delete_attachment(uuid: String, attachment_id: String, headers: Headers, conn _delete_cipher_attachment_by_id(&uuid, &attachment_id, &headers, &conn) } +#[delete("/ciphers//attachment//admin")] +fn delete_attachment_admin(uuid: String, attachment_id: String, headers: Headers, conn: DbConn) -> EmptyResult { + _delete_cipher_attachment_by_id(&uuid, &attachment_id, &headers, &conn) +} + #[post("/ciphers//delete")] fn delete_cipher_post(uuid: String, headers: Headers, conn: DbConn) -> EmptyResult { _delete_cipher_by_uuid(&uuid, &headers, &conn) @@ -535,6 +540,11 @@ fn delete_cipher(uuid: String, headers: Headers, conn: DbConn) -> EmptyResult { _delete_cipher_by_uuid(&uuid, &headers, &conn) } +#[delete("/ciphers//admin")] +fn delete_cipher_admin(uuid: String, headers: Headers, conn: DbConn) -> EmptyResult { + _delete_cipher_by_uuid(&uuid, &headers, &conn) +} + #[delete("/ciphers", data = "")] fn delete_cipher_selected(data: JsonUpcase, headers: Headers, conn: DbConn) -> EmptyResult { let data: Value = data.into_inner().data; diff --git a/src/api/core/mod.rs b/src/api/core/mod.rs index f465a44..d2ad208 100644 --- a/src/api/core/mod.rs +++ b/src/api/core/mod.rs @@ -43,6 +43,7 @@ pub fn routes() -> Vec { delete_attachment_post, delete_attachment_post_admin, delete_attachment, + delete_attachment_admin, post_cipher_admin, post_cipher_share, put_cipher_share, @@ -52,6 +53,7 @@ pub fn routes() -> Vec { delete_cipher_post, delete_cipher_post_admin, delete_cipher, + delete_cipher_admin, delete_cipher_selected, delete_cipher_selected_post, delete_all,