helpyourneighbour/issue_10.md
BibaBot Jarvis b4990297ce
Some checks are pending
Docker Test / test (push) Waiting to run
feat: implement role-based access control middleware and update routes
2026-03-16 14:10:16 +00:00

1 KiB

Issue: Implement Role-Based Access Control (RBAC) for API Endpoints

Description

Implement role-based access control (RBAC) for the API endpoints to ensure that only users with the appropriate roles can access specific resources. This includes implementing middleware to check user roles and updating existing routes to use this middleware.

Acceptance Criteria

  • Middleware requireRole is implemented and tested
  • All existing API routes are updated to use the requireRole middleware where necessary
  • The middleware correctly checks if the user has at least one of the required roles
  • Unauthorized access attempts return a 403 Forbidden status
  • The implementation is consistent with the documented roles and permissions
  • backend/middleware/role.middleware.js
  • backend/controllers/
  • backend/routes/

Notes

This task builds upon the existing role definitions in docs/roles-and-permissions.md and ensures that the backend enforces these permissions correctly.