Simplify
This commit is contained in:
parent
fc2f73ddb5
commit
ed76893581
2 changed files with 6 additions and 16 deletions
|
@ -148,8 +148,12 @@ impl ApiHandler for AdminApiServer {
|
||||||
Endpoint::CreateBucket => handle_create_bucket(&self.garage, req).await,
|
Endpoint::CreateBucket => handle_create_bucket(&self.garage, req).await,
|
||||||
Endpoint::DeleteBucket { id } => handle_delete_bucket(&self.garage, id).await,
|
Endpoint::DeleteBucket { id } => handle_delete_bucket(&self.garage, id).await,
|
||||||
// Bucket-key permissions
|
// Bucket-key permissions
|
||||||
Endpoint::BucketAllowKey => handle_bucket_allow_key(&self.garage, req).await,
|
Endpoint::BucketAllowKey => {
|
||||||
Endpoint::BucketDenyKey => handle_bucket_deny_key(&self.garage, req).await,
|
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!(
|
_ => Err(Error::NotImplemented(format!(
|
||||||
"Admin endpoint {} not implemented yet",
|
"Admin endpoint {} not implemented yet",
|
||||||
endpoint.name()
|
endpoint.name()
|
||||||
|
|
|
@ -369,20 +369,6 @@ pub async fn handle_delete_bucket(
|
||||||
.body(Body::empty())?)
|
.body(Body::empty())?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_bucket_allow_key(
|
|
||||||
garage: &Arc<Garage>,
|
|
||||||
req: Request<Body>,
|
|
||||||
) -> Result<Response<Body>, Error> {
|
|
||||||
handle_bucket_change_key_perm(garage, req, true).await
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn handle_bucket_deny_key(
|
|
||||||
garage: &Arc<Garage>,
|
|
||||||
req: Request<Body>,
|
|
||||||
) -> Result<Response<Body>, Error> {
|
|
||||||
handle_bucket_change_key_perm(garage, req, false).await
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn handle_bucket_change_key_perm(
|
pub async fn handle_bucket_change_key_perm(
|
||||||
garage: &Arc<Garage>,
|
garage: &Arc<Garage>,
|
||||||
req: Request<Body>,
|
req: Request<Body>,
|
||||||
|
|
Loading…
Reference in a new issue