feat(bookings): restrict management to assigned PIC or super admin
Secure API endpoints with requireBookingManager authorization check Update confirmation page to prompt for login if unauthorized Add safe redirect handling to login and guest middleware
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { ConfirmBookingResponse } from '~~/shared/booking'
|
||||
|
||||
import { requireBookingManager } from '../../../../utils/auth'
|
||||
import { confirmBookingByConfirmationToken, getBookingByConfirmationToken, getBookingInventorySummary } from '../../../../utils/booking-repository'
|
||||
import { getRequiredRouteParam, httpError } from '../../../../utils/http'
|
||||
import { sendBookingTicketReceiptViaWhatsApp } from '../../../../utils/whatsapp'
|
||||
@@ -12,6 +13,8 @@ export default defineEventHandler(async (event): Promise<ConfirmBookingResponse>
|
||||
httpError(404, 'Booking not found')
|
||||
}
|
||||
|
||||
await requireBookingManager(event, existingBooking)
|
||||
|
||||
if (existingBooking.status === 'confirmed') {
|
||||
return {
|
||||
booking: existingBooking,
|
||||
|
||||
Reference in New Issue
Block a user