feat: server-side user search + user org membership in dashboard#678
Merged
Conversation
- extend storage ListUsers with an optional case-insensitive substring filter over email/given_name/family_name/nickname across all providers - SQL/Mongo/Arango/Couchbase use native LIKE/$regex; DynamoDB and Cassandra/ScyllaDB scan-and-filter (O(n), no substring index) — documented - thread the query param through gRPC UsersRequest and a new GraphQL ListUsersRequest input; regenerate gen/ and gqlgen output - dashboard: debounce the search box and drive the list from the server, dropping the page-local client-side filter
- add a super-admin GraphQL query returning the organizations a user belongs to with per-org roles, backed by the existing ListOrgMembershipsByUser storage method (GraphQL-only, matching the org admin surface) - keep it off the User type so user-list rows stay cheap; the dashboard user detail view fetches it lazily and degrades gracefully on error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses two dashboard user-admin gaps.
1. Server-side user search (was client-side only)
The Users page filtered
email.includes(q)over the current page only, so search missed users on other pages — the server_usersquery had no search param. Now:_userstakesListUsersRequest { pagination, query }; storageListUsersgains a case-insensitive search over email / given_name / family_name / nickname, across all 6 provider families.LIKE, Mongo$regex+QuoteMeta, ArangoLIKE(...,true), Couchbase N1QL); DynamoDB and Cassandra/Scylla do a documented O(n) scan+filter (no substring index on a non-key attr) —ponytail:comments name the upgrade path (GSI/SASI/external search).queryto the server, resets to page 1, and drops the client-only filter.2. User's organizations in user details
The
Usertype had no org info and there was no by-user org query. Adds_user_organizations(user_id)(super-admin gated) returning each org + the user's roles there;ViewUserModallazily fetches and shows an "Organizations" section (with empty + error states). StorageListOrgMembershipsByUseralready existed across providers.Reviews
_user_organizationsgates on super-admin and skips dangling memberships, secrets are never in the searchable field set, proto/schema changes are back-compatible.tsc/build/prettier clean.Notes
_usersGraphQL arg typePaginatedRequest→ListUsersRequest(field-compatible; admin-only). ProtoUsersRequest.queryis additive.%/_semantics differ across backends (live wildcard on LIKE providers vs literal on Mongo/Dynamo/Cassandra); could escape LIKE wildcards for consistency later.