Update user profile (Admin only)
PUT/company/users/:id
Allows an administrator to edit the profile of any user in the company.
Objective
To facilitate user management by administrators, enabling them to modify the data of any user in the company.
Use Cases
- Update a user's data as an administrator
- Change a user's role
- Modify a user's email
- Update contact information
Authentication & Authorization
- Requires a valid JWT (middleware m.isLogged)
- Requires admin or dev role (middleware m.isAdmin)
- Requires UTC validation (mTools.checkUTC)
Validations
- Email validated to prevent duplicates
- Role validated with model.getValidRole()
- Data validated with model.validateData()
- Verifies that the user belongs to the company
Notes
- Similar to PUT /me but for any user in the company
- Only administrators can access
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 406
Profile updated successfully
Invalid request. Possible causes:
- Invalid form data
- Email already exists (USER_ALREADY_EXIST)
Unauthorized (admin or dev role required)
Forbidden (user is not an administrator)
User not found
Email already exists in the database.