8000 feat: support filtering users table by login type by utsavll0 · Pull Request #17238 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: support filtering users table by login type #17238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 9, 2025
Prev Previous commit
Next Next commit
filter by multiple login types
  • Loading branch information
utsavll0 committed Apr 7, 2025
commit 5ddc42af755e722d731f9c88eee4eb3651fd99aa
10 changes: 6 additions & 4 deletions codersdk/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type UsersRequest struct {
// Filter users by status.
Status UserStatus `json:"status,omitempty" typescript:"-"`
// Filter users that have the given role.
Role string `json:"role,omitempty" typescript:"-"`
LoginType LoginType `json:"login_type,omitempty" typescript:"-"`
Role string `json:"role,omitempty" typescript:"-"`
LoginType []LoginType `json:"login_type,omitempty" typescript:"-"`

SearchQuery string `json:"q,omitempty"`
Pagination
Expand Down Expand Up @@ -724,8 +724,10 @@ func (c *Client) Users(ctx context.Context, req UsersRequest) (GetUsersResponse,
if req.SearchQuery != "" {
params = append(params, req.SearchQuery)
}
if req.LoginType != "" {
params = append(params, "login_type:"+string(req.LoginType))
if len(req.LoginType) > 0 {
for _, lt := range req.LoginType {
params = append(params, "login_type:"+string(lt))
}
}
q.Set("q", strings.Join(params, " "))
r.URL.RawQuery = q.Encode()
Expand Down
0