feat(policy): add Service principal, ArnLike/IfExists conditions, and logging error ordering (#2018)

This commit is contained in:
安正超
2026-03-01 08:44:42 +08:00
committed by GitHub
parent 2c01b8c49d
commit 7eb136faf0
8 changed files with 246 additions and 76 deletions
+5 -5
View File
@@ -1370,11 +1370,11 @@ impl S3Access for FS {
authorize_request(req, Action::S3Action(S3Action::PutBucketLifecycleAction)).await
}
/// Checks whether the PutBucketLogging request has accesses to the resources.
///
/// This method returns `Ok(())` by default.
async fn put_bucket_logging(&self, _req: &mut S3Request<PutBucketLoggingInput>) -> S3Result<()> {
Ok(())
async fn put_bucket_logging(&self, req: &mut S3Request<PutBucketLoggingInput>) -> S3Result<()> {
let req_info = ext_req_info_mut(&mut req.extensions)?;
req_info.bucket = Some(req.input.bucket.clone());
authorize_request(req, Action::S3Action(S3Action::PutBucketLoggingAction)).await
}
/// Checks whether the PutBucketMetricsConfiguration request has accesses to the resources.
+23 -1
View File
@@ -19,7 +19,7 @@ use rustfs_ecstore::{
bucket::tagging::decode_tags_to_map,
error::{is_err_object_not_found, is_err_version_not_found},
new_object_layer_fn,
store_api::{ObjectOperations, ObjectOptions},
store_api::{BucketOperations, BucketOptions, ObjectOperations, ObjectOptions},
};
use s3s::{S3, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, dto::*, s3_error};
use serde::{Deserialize, Serialize};
@@ -1022,6 +1022,28 @@ impl S3 for FS {
usecase.execute_put_bucket_cors(req).await
}
async fn get_bucket_logging(&self, req: S3Request<GetBucketLoggingInput>) -> S3Result<S3Response<GetBucketLoggingOutput>> {
let Some(store) = new_object_layer_fn() else {
return Err(s3_error!(InternalError, "Not init"));
};
store
.get_bucket_info(&req.input.bucket, &BucketOptions::default())
.await
.map_err(crate::error::ApiError::from)?;
Err(s3_error!(NotImplemented, "GetBucketLogging is not implemented yet"))
}
async fn put_bucket_logging(&self, req: S3Request<PutBucketLoggingInput>) -> S3Result<S3Response<PutBucketLoggingOutput>> {
let Some(store) = new_object_layer_fn() else {
return Err(s3_error!(InternalError, "Not init"));
};
store
.get_bucket_info(&req.input.bucket, &BucketOptions::default())
.await
.map_err(crate::error::ApiError::from)?;
Err(s3_error!(NotImplemented, "PutBucketLogging is not implemented yet"))
}
async fn put_bucket_encryption(
&self,
req: S3Request<PutBucketEncryptionInput>,