Skip to content

feat: Add user role management to admin account detail page#814

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-admin-users-card
Jan 20, 2026
Merged

feat: Add user role management to admin account detail page#814
bokelley merged 1 commit into
mainfrom
bokelley/fix-admin-users-card

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • Fix Users section collapsed by default on admin account detail page
  • Add ability to change user roles (Member/Admin) via dropdown in the Users section
  • Owner role shown but disabled (cannot be assigned via dropdown)

Changes

  • Database: Add role column to organization_memberships table (migration 181)
  • Backend: Update WorkOS webhooks to cache role from membership events
  • Backend: Add PUT /api/admin/accounts/:orgId/members/:userId/role endpoint
  • Backend: Include role in account detail API response
  • Frontend: Add role dropdown UI with Member/Admin/Owner options
  • Frontend: Use AdminSidebar.fetch for proper 401 redirect handling

Test plan

  • Users section is expanded by default (not collapsed)
  • Role dropdown appears for each user in the Users section
  • Owner role is shown but disabled
  • Build succeeds
  • All tests pass

🤖 Generated with Claude Code

- Fix Users section collapsed by default - removed collapsed class
- Add role column to organization_memberships table (migration 181)
- Update WorkOS webhooks to cache role from membership events
- Add PUT /api/admin/accounts/:orgId/members/:userId/role endpoint
- Include role in account detail API response
- Add role dropdown UI (Member/Admin/Owner options)
- Owner role shown but disabled (cannot be assigned via dropdown)

The role update endpoint:
- Validates role is assignable (admin or member only)
- Verifies membership belongs to org via WorkOS API
- Updates both WorkOS and local cache
- Logs admin email and previous role for audit trail

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit ab3a0d0 into main Jan 20, 2026
6 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