mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-18 21:26:56 +00:00
Reused the precomputed principal when setting tableBucketMetadata.OwnerAccountID, avoiding the redundant getAccountID call.
This commit is contained in:
@@ -30,11 +30,8 @@ func (h *S3TablesHandler) handleCreateTableBucket(w http.ResponseWriter, r *http
|
||||
identityActions := getIdentityActions(r)
|
||||
identityPolicyNames := getIdentityPolicyNames(r)
|
||||
if h.shouldUseIAM(r, identityActions, identityPolicyNames) {
|
||||
ownerAccountID := principal
|
||||
tableBucketARN := h.generateTableBucketARN(ownerAccountID, req.Name)
|
||||
s3BucketARN := fmt.Sprintf("arn:aws:s3:::%s", req.Name)
|
||||
allowed, err := h.authorizeIAMAction(r, identityPolicyNames, "s3tables:CreateTableBucket", tableBucketARN, s3BucketARN)
|
||||
if err != nil || !allowed {
|
||||
sessionToken := extractSessionToken(r)
|
||||
if !h.authorizeIAMAction(r, identityPolicyNames, "CreateTableBucket", h.generateTableBucketARN(principal, req.Name), fmt.Sprintf("arn:aws:s3:::%s", req.Name)) {
|
||||
h.writeError(w, http.StatusForbidden, ErrCodeAccessDenied, "not authorized to create table buckets")
|
||||
return NewAuthError("CreateTableBucket", principal, "not authorized to create table buckets")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user