Skip to content

Predictive user search for adding team members - #141

Merged
snevesbarros merged 1 commit into
masterfrom
ccr-2db5932d-yi60a6
Oct 16, 2026
Merged

snevesbarros merged 1 commit into
masterfrom
ccr-2db5932d-yi60a6

Conversation

@snevesbarros

Copy link
Copy Markdown
Collaborator

Summary

Back-end for a type-ahead on the Team Settings "add member" box.

GET /team/:teamId/members/candidates?q= returns up to 10 users whose username contains q (case-insensitive), ordered by username, leaving out users already in the team.

  • q must be 3 to 50 characters of [A-Za-z0-9-_] (422 otherwise). The pattern is safe to use in a regex as is.
  • Allowed for admins and the team's own leads, and session-only (API tokens get 403), like the other member routes.
  • For a team lead it returns plain user accounts only, which is exactly what a lead can add, so it does not expose admins or other leads. Admins also see team leads and admins.
  • Responses contain only _id, username and role.
  • Swagger updated.

This is a deliberate, narrow directory lookup: team leads cannot list users otherwise, so the minimum length, the result cap and the role filter keep it from becoming a way to enumerate all accounts.

Testing

9 new tests in test/team-members.tests.js: substring and case-insensitive matching, excluding current members, role filtering for lead vs admin, empty result, the 10-result cap, 422 for short or invalid q, 403 for a member, another team's lead and API tokens, 404 for an unknown team. All 41 tests in that file pass. I did not re-run the full suite for this change.

Companion PRs: AnglesHQ/angles-ui and AnglesHQ/angles-javascript-client.

🤖 Generated with Claude Code

https://claude.ai/code/session_0121r5gnmvth6hy4tPpNT8sM


Generated by Claude Code

GET /team/:teamId/members/candidates?q= returns up to 10 users whose username
contains q (3-50 chars), excluding current members. Admins and the team's leads
only, session-only. For a team lead it returns plain users only, matching what a
lead can add, so it does not expose admins or other leads.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0121r5gnmvth6hy4tPpNT8sM
@snevesbarros
snevesbarros merged commit eb10236 into master Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants