mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
feat: filter users by github user id in the users list CLI command (#17029)
Add the `--github-user-id` option to `coder users list`, which makes the command only return users with a matching GitHub user id. This will enable https://github.com/coder/start-workspace-action to find a Coder user that corresponds to a GitHub user requesting to start a workspace.
This commit is contained in:
@ -6578,6 +6578,16 @@ func (q *FakeQuerier) GetUsers(_ context.Context, params database.GetUsersParams
|
||||
users = usersFilteredByLastSeen
|
||||
}
|
||||
|
||||
if params.GithubComUserID != 0 {
|
||||
usersFilteredByGithubComUserID := make([]database.User, 0, len(users))
|
||||
for i, user := range users {
|
||||
if user.GithubComUserID.Int64 == params.GithubComUserID {
|
||||
usersFilteredByGithubComUserID = append(usersFilteredByGithubComUserID, users[i])
|
||||
}
|
||||
}
|
||||
users = usersFilteredByGithubComUserID
|
||||
}
|
||||
|
||||
beforePageCount := len(users)
|
||||
|
||||
if params.OffsetOpt > 0 {
|
||||
|
Reference in New Issue
Block a user