mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-04 19:17:46 +01:00
Reused the precomputed principal when setting tableBucketMetadata.OwnerAccountID, avoiding the redundant getAccountID call.
This commit is contained in:
1 parent
d13913e2cd
commit
89abe98b8a
1 file changed
+2
-5
@@ -30,11 +30,8 @@ func (h *S3TablesHandler) handleCreateTableBucket(w http.ResponseWriter, r *http
|
|||||||
identityActions := getIdentityActions(r)
|
identityActions := getIdentityActions(r)
|
||||||
identityPolicyNames := getIdentityPolicyNames(r)
|
identityPolicyNames := getIdentityPolicyNames(r)
|
||||||
if h.shouldUseIAM(r, identityActions, identityPolicyNames) {
|
if h.shouldUseIAM(r, identityActions, identityPolicyNames) {
|
||||||
ownerAccountID := principal
|
sessionToken := extractSessionToken(r)
|
||||||
tableBucketARN := h.generateTableBucketARN(ownerAccountID, req.Name)
|
if !h.authorizeIAMAction(r, identityPolicyNames, "CreateTableBucket", h.generateTableBucketARN(principal, req.Name), fmt.Sprintf("arn:aws:s3:::%s", 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 {
|
|
||||||
h.writeError(w, http.StatusForbidden, ErrCodeAccessDenied, "not authorized to create table buckets")
|
h.writeError(w, http.StatusForbidden, ErrCodeAccessDenied, "not authorized to create table buckets")
|
||||||
return NewAuthError("CreateTableBucket", principal, "not authorized to create table buckets")
|
return NewAuthError("CreateTableBucket", principal, "not authorized to create table buckets")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user