Skip to content

Add admins to cohort member list on access (ARB-510)#389

Merged
crthpl merged 1 commit intomainfrom
worktree-scalable-moseying-ritchie
Apr 13, 2026
Merged

Add admins to cohort member list on access (ARB-510)#389
crthpl merged 1 commit intomainfrom
worktree-scalable-moseying-ritchie

Conversation

@crthpl
Copy link
Copy Markdown
Contributor

@crthpl crthpl commented Apr 13, 2026

Summary

When an admin accesses a cohort via WebSocket, they are now automatically added to the global cohort member list. Previously, admins could access any cohort due to authorization bypass, but they weren't recorded as members of the cohort.

Changes

  • Modified authenticate function in backend/src/handle_socket.rs to add admins to the cohort_member table on first access
  • Similar logic to the existing dev-mode auto-add for regular users, but applies to all admins in production
  • Uses add_member_by_user_id to insert the admin into the cohort_member table with no initial balance set

Testing

  • All existing tests pass (cargo test-all)
  • All linting checks pass (cargo clippy)
  • Verified compilation with no errors

When an admin connects to a cohort via WebSocket, they should be automatically
added to the global cohort_member table if they're not already a member. This
ensures the admin cohort member list accurately reflects who has accessed the cohort.

Previously, admins were allowed to access any cohort due to the is_admin authorization
check, but they were never added to the cohort member list. Now, after authentication,
we ensure admins are added as members of the cohort they're accessing.
@crthpl crthpl requested a review from a team as a code owner April 13, 2026 23:02
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
platform Ready Ready Preview, Comment Apr 13, 2026 11:02pm

Request Review

@crthpl crthpl merged commit 3fedb38 into main Apr 13, 2026
5 checks 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.

1 participant