POST /api/users//roles/
Assigns a role to a user, granting them the associated permissions. This endpoint requires write privileges or admin role.Authentication
This endpoint requires JWT authentication with one of the following:WRITE_PRIVILEGESauthorityADMINrole
Path Parameters
The unique identifier of the user
The unique identifier of the role to assign
Response
This endpoint returns no content on success (HTTP 204).Error Codes
204- Role assigned successfully (no content returned)401- Unauthorized: Missing or invalid JWT token403- Forbidden: Insufficient permissions404- Not Found: User or role does not exist
Example Request
Example Success Response
Example Error Response
Notes
- A user can have multiple roles assigned
- Assigning a role grants the user all permissions associated with that role
- If the user already has the role assigned, the operation will succeed without changes
- This action is logged in the audit log with module “USUARIOS” and action “ASIGNAR_ROL”