aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-07-11 21:15:37 -0700
committerGitHub <noreply@github.com>2022-07-11 21:15:37 -0700
commitde97ba94c3b27127704999ba4b53095168ad0cdb (patch)
tree2cfa0d6a4624eaa5bd3d6b87b5331a4a5d91dc32
parentcf241c8901380a0183cf470e6c89c4d76f5c2781 (diff)
parentb3076909d1c7d3d55d49f7c9e1b28974beaa3a05 (diff)
downloadseaweedfs-de97ba94c3b27127704999ba4b53095168ad0cdb.tar.xz
seaweedfs-de97ba94c3b27127704999ba4b53095168ad0cdb.zip
Merge pull request #3302 from guo-sj/fix_put_user_policy
-rw-r--r--weed/iamapi/iamapi_management_handlers.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.go
index d3b1e7b28..e1f215bd3 100644
--- a/weed/iamapi/iamapi_management_handlers.go
+++ b/weed/iamapi/iamapi_management_handlers.go
@@ -213,23 +213,18 @@ func (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values
if err != nil {
return PutUserPolicyResponse{}, err
}
- isFound := false
policyDocuments[policyName] = &policyDocument
actions := GetActions(&policyDocument)
for _, ident := range s3cfg.Identities {
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
}
- 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) {