Skip to content

Commit

Permalink
Fix ACLCommand.UsersList nextToken forwarding (#44119)
Browse files Browse the repository at this point in the history
  • Loading branch information
smallinsky authored Jul 15, 2024
1 parent e05dd7f commit 2a39910
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tool/tctl/common/acl_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,15 @@ func (c *ACLCommand) UsersRemove(ctx context.Context, client *authclient.Client)

// UsersList will list the users in an access list.
func (c *ACLCommand) UsersList(ctx context.Context, client *authclient.Client) error {
var allMembers []*accesslist.AccessListMember
var nextToken string
var (
allMembers []*accesslist.AccessListMember
nextToken string
err error
members []*accesslist.AccessListMember
)

for {
members, nextToken, err := client.AccessListClient().ListAccessListMembers(ctx, c.accessListName, 0, nextToken)
members, nextToken, err = client.AccessListClient().ListAccessListMembers(ctx, c.accessListName, 0, nextToken)
if err != nil {
return trace.Wrap(err)
}
Expand All @@ -203,6 +208,7 @@ func (c *ACLCommand) UsersList(ctx context.Context, client *authclient.Client) e
break
}
}

switch c.format {
case teleport.JSON:
return trace.Wrap(utils.WriteJSONArray(os.Stdout, allMembers))
Expand Down

0 comments on commit 2a39910

Please sign in to comment.