# updateUserRoles

## Overview

Updates a user's role assignments. Accepts the full list of desired role IDs, computes the diff against current assignments, and assigns/revokes as needed. Only ACTIVE users can have their roles updated.

## Modules Commands Used

- `user-management.assignRoleToUser` — Assigns newly selected roles
- `user-management.revokeRoleFromUser` — Revokes deselected roles

## Exception Handling

| Error Code | Source | Description |
| --- | --- | --- |
| USER_NOT_FOUND | assignRoleToUser / revokeRoleFromUser | The specified user does not exist |
| USER_NOT_ACTIVE | assignRoleToUser | The specified user is not in ACTIVE status |
| ROLE_NOT_FOUND | assignRoleToUser / revokeRoleFromUser | A specified role does not exist |
| ROLE_NOT_ACTIVE | assignRoleToUser | A specified role is not in ACTIVE status |
| ASSIGNMENT_NOT_FOUND | revokeRoleFromUser | The role was not assigned to the user (silently ignored) |
