Browse Source

Merge pull request #3340 from vanhtuan0409/put-user-policy

pull/3348/head
Chris Lu 2 years ago
committed by GitHub
parent
commit
efec31de8d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      weed/iamapi/iamapi_management_handlers.go

11
weed/iamapi/iamapi_management_handlers.go

@ -219,9 +219,17 @@ 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 {
if !existedActions[action] {
ident.Actions = append(ident.Actions, action)
}
}
return resp, nil
}
return resp, fmt.Errorf("%s: the user with name %s cannot be found", iam.ErrCodeNoSuchEntityException, userName)
@ -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,

Loading…
Cancel
Save