SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
refine PutUserPolicy
guosj7dbf19d09a13
diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.goindex 488e92aa5c..fdd943b284 100644--- a/weed/iamapi/iamapi_management_handlers.go+++ b/weed/iamapi/iamapi_management_handlers.go@@ -204,6 +204,7 @@ func (iama *IamApiServer) CreatePolicy(s3cfg *iam_pb.S3ApiConfiguration, valuesreturn resp, nil}+// https://docs.aws.amazon.com/IAM/latest/APIReference/API_PutUserPolicy.htmlfunc (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp PutUserPolicyResponse, err error) {userName := values.Get("UserName")policyName := values.Get("PolicyName")@@ -212,15 +213,21 @@ func (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, valuesif err != nil {return PutUserPolicyResponse{}, err}+ isFound := falsepolicyDocuments[policyName] = &policyDocumentactions := GetActions(&policyDocument)for _, ident := range s3cfg.Identities {- if userName == ident.Name {- for _, action := range actions {- ident.Actions = append(ident.Actions, action)- }- break+ if userName != ident.Name {+ continue+ }+ isFound = true+ for _, action := range actions {+ ident.Actions = append(ident.Actions, action)}+ break+ }+ if !isFound {+ return resp, fmt.Errorf("%s: the user with name %s cannot be found", iam.ErrCodeNoSuchEntityException, userName)}return resp, nil}