diff options
| author | chrislu <chris.lu@gmail.com> | 2022-07-11 23:43:09 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-07-11 23:43:09 -0700 |
| commit | fa1e88d94fed1c693844add7965603ae3712fb8f (patch) | |
| tree | f4b5d8e4de85eff0a05b16269c2822cbd9b4f4ca /weed | |
| parent | f5a76f67c14c0216a5f6862f1b7212983aefb941 (diff) | |
| parent | de97ba94c3b27127704999ba4b53095168ad0cdb (diff) | |
| download | seaweedfs-fa1e88d94fed1c693844add7965603ae3712fb8f.tar.xz seaweedfs-fa1e88d94fed1c693844add7965603ae3712fb8f.zip | |
Merge branch 'master' into messaging
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/iamapi/iamapi_management_handlers.go | 19 | ||||
| -rw-r--r-- | weed/util/constants.go | 2 |
2 files changed, 9 insertions, 12 deletions
diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.go index 488e92aa5..e1f215bd3 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, values return resp, nil } +// https://docs.aws.amazon.com/IAM/latest/APIReference/API_PutUserPolicy.html func (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp PutUserPolicyResponse, err error) { userName := values.Get("UserName") policyName := values.Get("PolicyName") @@ -215,14 +216,15 @@ func (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values policyDocuments[policyName] = &policyDocument actions := 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 + } + for _, action := range actions { + ident.Actions = append(ident.Actions, action) } + return resp, nil } - return resp, nil + return resp, fmt.Errorf("%s: the user with name %s cannot be found", iam.ErrCodeNoSuchEntityException, userName) } func (iama *IamApiServer) GetUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp GetUserPolicyResponse, err error) { @@ -412,14 +414,11 @@ func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) { return } values := r.PostForm - var s3cfgLock sync.RWMutex - s3cfgLock.RLock() s3cfg := &iam_pb.S3ApiConfiguration{} if err := iama.s3ApiConfig.GetS3ApiConfiguration(s3cfg); err != nil { s3err.WriteErrorResponse(w, r, s3err.ErrInternalError) return } - s3cfgLock.RUnlock() glog.V(4).Infof("DoActions: %+v", values) var response interface{} @@ -498,9 +497,7 @@ func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) { return } if changed { - s3cfgLock.Lock() err := iama.s3ApiConfig.PutS3ApiConfiguration(s3cfg) - s3cfgLock.Unlock() if err != nil { writeIamErrorResponse(w, r, fmt.Errorf(iam.ErrCodeServiceFailureException), "", "", err) return diff --git a/weed/util/constants.go b/weed/util/constants.go index 7448fad62..8438624bf 100644 --- a/weed/util/constants.go +++ b/weed/util/constants.go @@ -5,7 +5,7 @@ import ( ) var ( - VERSION_NUMBER = fmt.Sprintf("%.02f", 3.14) + VERSION_NUMBER = fmt.Sprintf("%.02f", 3.15) VERSION = sizeLimit + " " + VERSION_NUMBER COMMIT = "" ) |
