Skip to content

Conversation

Ermegilius
Copy link
Contributor

This pull request implements stricter role-based access control and organization context validation for the "My Bookings" feature. It refactors both backend and frontend logic to ensure only users with appropriate roles ("user" or "requester") and a valid organization context can view their bookings. The changes also improve error handling and user feedback for invalid context or insufficient permissions.

Backend validation and API changes:

  • Updated BookingController and BookingService to validate the presence of x-org-id, x-role-name, and user ID in requests, throwing exceptions if missing, and refactored method signatures to require these parameters explicitly. [1] [2] [3]
  • Removed redundant extraction of context and user ID from request in service methods, relying on controller-level validation and passing explicit arguments. [1] [2]

Frontend logic and state management:

  • Added a new thunk getOwnBookings and related API method to fetch bookings for the current authenticated user with required organization and role context. Also introduced a clearUserBookings action to reset state when context changes. [1] [2] [3] [4] [5]
  • Refactored MyBookings.tsx to use role and organization context for fetching bookings, display error messages for invalid context or insufficient role, and clear bookings when context changes. [1] [2] [3] [4] [5] [6] [7]

User feedback and translations:

  • Added new translations and error messages for invalid context and insufficient role scenarios in the "My Bookings" module.

Miscellaneous:

  • Minor cleanup and reordering of fields in package.json for consistency. [1] [2]

Copy link

supabase bot commented Sep 4, 2025

This pull request has been ignored for the connected project rcbddkhvysexkvgqpcud because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@maria-aluko maria-aluko self-requested a review September 5, 2025 07:27
@maria-aluko
Copy link
Contributor

Nice work. We would need to refactor a bit based on the feedback, but I noticed we already have a ticket for it. Looks good!

@maria-aluko maria-aluko merged commit fd2d22f into develop Sep 5, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants