mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactor code
This commit is contained in:
parent
7dbf19d09a
commit
b3076909d1
|
@ -213,23 +213,18 @@ func (iama *IamApiServer) PutUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return PutUserPolicyResponse{}, err
|
return PutUserPolicyResponse{}, err
|
||||||
}
|
}
|
||||||
isFound := false
|
|
||||||
policyDocuments[policyName] = &policyDocument
|
policyDocuments[policyName] = &policyDocument
|
||||||
actions := GetActions(&policyDocument)
|
actions := GetActions(&policyDocument)
|
||||||
for _, ident := range s3cfg.Identities {
|
for _, ident := range s3cfg.Identities {
|
||||||
if userName != ident.Name {
|
if userName != ident.Name {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
isFound = true
|
|
||||||
for _, action := range actions {
|
for _, action := range actions {
|
||||||
ident.Actions = append(ident.Actions, action)
|
ident.Actions = append(ident.Actions, action)
|
||||||
}
|
}
|
||||||
break
|
return resp, nil
|
||||||
}
|
}
|
||||||
if !isFound {
|
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)
|
|
||||||
}
|
|
||||||
return resp, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (iama *IamApiServer) GetUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp GetUserPolicyResponse, err error) {
|
func (iama *IamApiServer) GetUserPolicy(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp GetUserPolicyResponse, err error) {
|
||||||
|
|
Loading…
Reference in a new issue