Skip to content

User Routes

Users Routes Documentation

Overview

The Users routes manage user-related functionalities, such as retrieving, updating, and deleting user information.

Route Details

  1. GET /

    /users

    • Controller: getAllUsers
    • Middleware: ensureAdmin
    • Functionality: Retrieves a list of all users. Accessible only to admins.
  2. GET /

    • Controller: getOneUser
    • Middleware: ensureCorrectUserOrAdmin
    • Functionality: Retrieves details of a specific user. Accessible to the user themselves or an admin.
  3. PUT /

    • Controller: updateUser
    • Middleware: ensureCorrectUserOrAdmin
    • Functionality: Updates details of a specific user. Accessible to the user themselves or an admin.
  4. DELETE /

    • Controller: deleteUser
    • Middleware: ensureAdmin
    • Functionality: Deletes a specific user. Accessible only to admins.

Improvements

  • Implement more granular access controls and audit logs for sensitive operations, especially update and delete operations.
  • Regularly review user access patterns to ensure compliance with privacy and security best practices.

Notes

  • Ensuring data privacy and adhering to