Browse Source

PutUserAction should completely replace identity actions

pull/3378/head
Tuan Vuong 2 years ago
parent
commit
1d9a888be9
  1. 12
      weed/iamapi/iamapi_management_handlers.go

12
weed/iamapi/iamapi_management_handlers.go

@ -219,17 +219,7 @@ 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)
}
}
ident.Actions = actions
return resp, nil
}
return resp, fmt.Errorf("%s: the user with name %s cannot be found", iam.ErrCodeNoSuchEntityException, userName)

Loading…
Cancel
Save