From ed768935815851a7e4b8880f0cb8fc91e35e3027 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 12 May 2022 11:21:23 +0200 Subject: [PATCH] Simplify --- src/api/admin/api_server.rs | 8 ++++++-- src/api/admin/bucket.rs | 14 -------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/api/admin/api_server.rs b/src/api/admin/api_server.rs index 6bdef56c..b3bc9221 100644 --- a/src/api/admin/api_server.rs +++ b/src/api/admin/api_server.rs @@ -148,8 +148,12 @@ impl ApiHandler for AdminApiServer { Endpoint::CreateBucket => handle_create_bucket(&self.garage, req).await, Endpoint::DeleteBucket { id } => handle_delete_bucket(&self.garage, id).await, // Bucket-key permissions - Endpoint::BucketAllowKey => handle_bucket_allow_key(&self.garage, req).await, - Endpoint::BucketDenyKey => handle_bucket_deny_key(&self.garage, req).await, + Endpoint::BucketAllowKey => { + handle_bucket_change_key_perm(&self.garage, req, true).await + } + Endpoint::BucketDenyKey => { + handle_bucket_change_key_perm(&self.garage, req, false).await + } _ => Err(Error::NotImplemented(format!( "Admin endpoint {} not implemented yet", endpoint.name() diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index 16e9c174..6901f139 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -369,20 +369,6 @@ pub async fn handle_delete_bucket( .body(Body::empty())?) } -pub async fn handle_bucket_allow_key( - garage: &Arc, - req: Request, -) -> Result, Error> { - handle_bucket_change_key_perm(garage, req, true).await -} - -pub async fn handle_bucket_deny_key( - garage: &Arc, - req: Request, -) -> Result, Error> { - handle_bucket_change_key_perm(garage, req, false).await -} - pub async fn handle_bucket_change_key_perm( garage: &Arc, req: Request,