Browse Source
Merge pull request #2034 from kmlebedev/iam_listkeys_filter
iam ListAccessKeys filtred by username
pull/2045/head
Chris Lu
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
0 deletions
-
weed/iamapi/iamapi_management_handlers.go
|
@ -114,7 +114,11 @@ func (iama *IamApiServer) ListUsers(s3cfg *iam_pb.S3ApiConfiguration, values url |
|
|
|
|
|
|
|
|
func (iama *IamApiServer) ListAccessKeys(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp ListAccessKeysResponse) { |
|
|
func (iama *IamApiServer) ListAccessKeys(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp ListAccessKeysResponse) { |
|
|
status := iam.StatusTypeActive |
|
|
status := iam.StatusTypeActive |
|
|
|
|
|
userName := values.Get("UserName") |
|
|
for _, ident := range s3cfg.Identities { |
|
|
for _, ident := range s3cfg.Identities { |
|
|
|
|
|
if userName != "" && userName != ident.Name { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
for _, cred := range ident.Credentials { |
|
|
for _, cred := range ident.Credentials { |
|
|
resp.ListAccessKeysResult.AccessKeyMetadata = append(resp.ListAccessKeysResult.AccessKeyMetadata, |
|
|
resp.ListAccessKeysResult.AccessKeyMetadata = append(resp.ListAccessKeysResult.AccessKeyMetadata, |
|
|
&iam.AccessKeyMetadata{UserName: &ident.Name, AccessKeyId: &cred.AccessKey, Status: &status}, |
|
|
&iam.AccessKeyMetadata{UserName: &ident.Name, AccessKeyId: &cred.AccessKey, Status: &status}, |
|
|