From 7287390e0398570961fd998652bd180d6fb13b78 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 20 Sep 2022 15:53:16 +0200 Subject: Run clippy + add doc --- src/routes/model.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/routes/model.rs') diff --git a/src/routes/model.rs b/src/routes/model.rs index 4f935a9..0572977 100644 --- a/src/routes/model.rs +++ b/src/routes/model.rs @@ -109,12 +109,10 @@ async fn delete_model(claims: Claims, Path(model_id): Path) -> Result = model.upload_paths().await.unwrap(); + let uploads: Vec = model.list_upload_filepaths().await.unwrap(); - if model.author_id() != user.id { - if !user.is_staff.unwrap() { - return Err(AppError::Unauthorized); - } + if !(model.author_id() == user.id || user.is_staff.unwrap()) { + return Err(AppError::Unauthorized); } // If the model has been deleted, remove all old uploads from the file system -- cgit v1.2.3-71-g8e6c