mirror of
https://github.com/rustfs/rustfs.git
synced 2026-10-04 04:21:35 +00:00
fix: map IAM not-found errors to 404 in InfoCannedPolicy and RemoveUser
Merge the approved fix from pull request #8134.
This commit is contained in:
@@ -320,7 +320,7 @@ impl Operation for InfoCannedPolicy {
|
||||
error = ?e,
|
||||
"admin policy state"
|
||||
);
|
||||
S3Error::with_message(S3ErrorCode::InternalError, e.to_string())
|
||||
iam_error_to_s3_error(e)
|
||||
})?;
|
||||
|
||||
let body = serde_json::to_vec(&pd).map_err(|e| s3_error!(InternalError, "failed to serialize response: {:?}", e))?;
|
||||
|
||||
@@ -510,9 +510,7 @@ impl Operation for RemoveUser {
|
||||
return Err(s3_error!(InternalError, "iam is not initialized"));
|
||||
};
|
||||
|
||||
let (is_temp, _) = iam_store.is_temp_user(ak).await.map_err(|e| {
|
||||
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to query temporary user state: {e}"))
|
||||
})?;
|
||||
let (is_temp, _) = iam_store.is_temp_user(ak).await.map_err(iam_error_to_s3_error)?;
|
||||
|
||||
if is_temp {
|
||||
return Err(s3_error!(InvalidArgument, "cannot remove a temporary user"));
|
||||
|
||||
Reference in New Issue
Block a user