Skip to content

Team leads can add any user except the core admin; allow email usernames - #142

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

Fixes two problems with adding team members, found after the type-ahead shipped.

  • Email usernames: the member search (q) and POST /team/:id/members only accepted [A-Za-z0-9-_], so SSO accounts whose username is an email address could not be found or added. Both now accept . _ @ + - (search 3-254 chars, username 2-254). The search term is regex-escaped so . and + match literally.
  • Missing users: the search, add and remove all restricted team leads to users with the user role, so local team leads and admins never appeared. That restriction is removed: a team lead can add and remove any user, whatever their role or sign-in method.
  • Core admin: the seeded account (ANGLES_ADMIN_USERNAME, default admin, new helper getCoreAdminUsername) is never returned by the search, a team lead cannot add or remove it, and the member list flags it with isCoreAdmin so a client can show it as locked. Admins can still add it. Team leads still cannot remove themselves.

Consequences to be aware of

  • A team lead can now add another team lead or admin to their team, and an added team lead gets lead powers on that team. This was an explicit product decision.
  • Removal was widened to match, so a lead can undo what they add. Say if removal should stay stricter.

Swagger updated.

Testing

test/team-members.tests.js updated and extended (45 tests): leads see and can add other leads, admins and SSO users; the core admin is never offered and a lead cannot add or remove it; email-style usernames are found and added, with . and + matched literally; the isCoreAdmin flag. The suite points ANGLES_ADMIN_USERNAME at a test account, so it does not depend on an admin user existing. Full suite: 680 passing.

Companion PRs: AnglesHQ/angles-ui, AnglesHQ/angles-javascript-client, AnglesHQ/angleshq.github.io.

🤖 Generated with Claude Code

https://claude.ai/code/session_0121r5gnmvth6hy4tPpNT8sM


Generated by Claude Code

…ow email usernames

- Team leads can now add and remove any user: the role restriction (plain users only) is
  gone, from add, remove and the type-ahead search. The one exclusion is the core admin
  account (ANGLES_ADMIN_USERNAME, default "admin"): it is never offered, a team lead cannot
  add or remove it, and the member list flags it with isCoreAdmin. Team leads still cannot
  remove themselves.
- Usernames for membership accept . _ @ + - (2-254 chars) so SSO accounts whose username is
  an email address can be found and added. The search term is regex-escaped so . and + are
  matched literally.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0121r5gnmvth6hy4tPpNT8sM
@snevesbarros
snevesbarros merged commit bbadd17 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