Role management in TuKit is scoped exclusively to admin users. This endpoint completely replaces theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/tukit/llms.txt
Use this file to discover all available pages before exploring further.
roles array on a target user’s document using a MongoDB $set operation — it does not append to or merge with the existing roles. The caller must identify both the target user (userId) and themselves as the acting administrator (adminId). The controller verifies that the adminId account carries the role { name: "admin", value: "2" } before proceeding; if it does not, the request is rejected regardless of the JWT being otherwise valid.
POST /api/user/update-role/:userId/:adminId
Authentication
Path Parameters
The MongoDB ObjectId of the user whose roles are being updated.
The MongoDB ObjectId of the requesting administrator. This account must have a role of
{ name: "admin", value: "2" } or the request will be rejected.Request Body
An array of role objects to set on the target user. Each object must contain a
Example value:
name and a value key. The existing roles array is fully replaced by this value.Role reference:name | value | Description |
|---|---|---|
Usuario | "1" | Standard user |
admin | "2" | Administrator |
Response
200 — Success
Human-readable confirmation that the roles were updated (
"Rol de usuario actualizado correctamente").Always
true on success.The raw result object returned by Mongoose’s
updateOne(). Contains MongoDB write-result metadata.Error Responses
| Status | Cause |
|---|---|
404 | No user document found for the provided userId. |
404 | No user document found for the provided adminId. |
203 | The adminId account does not have a role of { name: "admin", value: "2" }. |
500 | Unexpected server or database error. |