mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
PutUserAction should completely replace identity actions
This commit is contained in:
parent
32d0413be1
commit
1d9a888be9
|
@ -219,17 +219,7 @@ func (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values
|
||||||
if userName != ident.Name {
|
if userName != ident.Name {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
ident.Actions = actions
|
||||||
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, nil
|
||||||
}
|
}
|
||||||
return resp, fmt.Errorf("%s: the user with name %s cannot be found", iam.ErrCodeNoSuchEntityException, userName)
|
return resp, fmt.Errorf("%s: the user with name %s cannot be found", iam.ErrCodeNoSuchEntityException, userName)
|
||||||
|
|
Loading…
Reference in a new issue