Skip to content

Conversation

@dauglyon
Copy link
Collaborator

@dauglyon dauglyon commented Jan 11, 2026

Summary

  • Adds new endpoint POST /api/V2/admin/users/{username}/roles for programmatic role assignment
  • Supports both built-in roles (Admin, DevToken, ServToken, CreateAdmin) and custom roles
  • Uses add/remove semantics for atomic updates

Request Body

{
  "addRoles": ["Admin", "DevToken"],
  "removeRoles": ["ServToken"],
  "addCustomRoles": ["custom_role_id"],
  "removeCustomRoles": ["old_role"]
}

Test plan

  • Run ./gradlew test and verify all tests pass
  • Start local server and test endpoint manually with curl
  • Verify 403 response when non-admin attempts role assignment
  • Verify 400 response for invalid role names

- Rename toRoleSet() to toRoles() to match TestMode.java naming
- Add separate noNulls() helper for null validation
- Preserve exception chain with e.getMessage() and cause
- Remove toStringSet() in favor of inline new HashSet<>()
- Update error messages to match existing patterns
@codecov
Copy link

codecov bot commented Jan 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.44%. Comparing base (77a783a) to head (37c0606).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #510      +/-   ##
=============================================
+ Coverage      93.40%   93.44%   +0.03%     
- Complexity      2158     2173      +15     
=============================================
  Files            129      129              
  Lines           7615     7658      +43     
  Branches        1170     1178       +8     
=============================================
+ Hits            7113     7156      +43     
  Misses           459      459              
  Partials          43       43              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dauglyon dauglyon closed this Jan 13, 2026
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