flip_api.user_services.set_user_roles
Attributes
Functions
|
Set roles for a user. |
Module Contents
- flip_api.user_services.set_user_roles.router
- flip_api.user_services.set_user_roles.set_user_roles(user_id: uuid.UUID, roles_data: flip_api.domain.interfaces.user.IRoles, db: sqlmodel.Session = Depends(get_session), token_id: uuid.UUID = Depends(verify_token)) flip_api.domain.interfaces.user.IRoles
Set roles for a user.
User existence is validated against Cognito (the source of truth) rather than a local DB row.
- Parameters:
user_id (UUID) – The ID of the user to update roles for.
roles_data (IRoles) – The roles data containing a list of role IDs to assign to the user.
db (Session) – The database session.
token_id (UUID) – The ID of the user making the request, used for permission checks.
- Returns:
The updated roles data for the user.
- Return type:
- Raises:
HTTPException – 403 if the caller lacks permission, 404 if the target user is not in Cognito, 400 if any role is invalid, or 503 if the Cognito existence check itself failed (transient — caller may retry).