diff options
| author | chrislu <chris.lu@gmail.com> | 2022-07-21 23:49:51 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-07-21 23:49:51 -0700 |
| commit | 35261c805efe56a05ae524b798e0158719cf7a04 (patch) | |
| tree | 563e07fbe996a9ed54e600ffb306f22552d628d6 /weed/iamapi/iamapi_management_handlers.go | |
| parent | 99739fa5a9c20174a1739e51d3a8b4c4d2ebd3b1 (diff) | |
| parent | 7a6c559ab4a6b696bb574454b297ebefabec29ed (diff) | |
| download | seaweedfs-35261c805efe56a05ae524b798e0158719cf7a04.tar.xz seaweedfs-35261c805efe56a05ae524b798e0158719cf7a04.zip | |
Merge branch 'master' into messaging
Diffstat (limited to 'weed/iamapi/iamapi_management_handlers.go')
| -rw-r--r-- | weed/iamapi/iamapi_management_handlers.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.go index e1f215bd3..8a42aa936 100644 --- a/weed/iamapi/iamapi_management_handlers.go +++ b/weed/iamapi/iamapi_management_handlers.go @@ -219,8 +219,16 @@ func (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values if userName != ident.Name { continue } + + existedActions := make(map[string]bool, len(ident.Actions)) + for _, action := range ident.Actions { + existedActions[action] = true + } + for _, action := range actions { - ident.Actions = append(ident.Actions, action) + if !existedActions[action] { + ident.Actions = append(ident.Actions, action) + } } return resp, nil } @@ -349,7 +357,8 @@ func (iama *IamApiServer) CreateAccessKey(s3cfg *iam_pb.S3ApiConfiguration, valu } if !changed { s3cfg.Identities = append(s3cfg.Identities, - &iam_pb.Identity{Name: userName, + &iam_pb.Identity{ + Name: userName, Credentials: []*iam_pb.Credential{ { AccessKey: accessKeyId, |
