security: A01-13 — nest all event routes under organisation prefix

Move all authenticated organiser-facing event sub-resource routes from
/events/{event}/... to /organisations/{organisation}/events/{event}/...
to enforce multi-tenancy at the routing layer.

Changes:
- Routes: restructured api.php to nest all event sub-resources under
  the existing organisation prefix group
- Controllers: added Organisation parameter and VerifiesOrganisationEvent
  trait to all 12 affected controllers (sections, time-slots, shifts,
  persons, crowd-lists, locations, shift-assignments, registration-fields,
  availabilities, field-values, section-preferences, stats)
- Tests: updated all 20 feature test files with new route paths
- Frontend: updated 8 API composables and 20 Vue components/pages
- API.md: updated documentation to reflect new route structure

Portal routes, public routes (volunteer-register), and invitation routes
remain unchanged as they operate without organisation context.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 08:16:36 +02:00
parent 51e5dd6fcb
commit 7932e53daf
64 changed files with 726 additions and 568 deletions

View File

@@ -13,7 +13,7 @@ interface PaginatedResponse<T> {
data: T[]
}
export function useTimeSlotList(eventId: Ref<string>, options?: { includeParent?: Ref<boolean> }) {
export function useTimeSlotList(orgId: Ref<string>, eventId: Ref<string>, options?: { includeParent?: Ref<boolean> }) {
const includeParent = options?.includeParent
return useQuery({
@@ -21,23 +21,23 @@ export function useTimeSlotList(eventId: Ref<string>, options?: { includeParent?
queryFn: async () => {
const params = includeParent?.value ? { include_parent: 'true' } : {}
const { data } = await apiClient.get<PaginatedResponse<TimeSlot>>(
`/events/${eventId.value}/time-slots`,
`/organisations/${orgId.value}/events/${eventId.value}/time-slots`,
{ params },
)
return data.data
},
enabled: () => !!eventId.value,
enabled: () => !!orgId.value && !!eventId.value,
})
}
export function useCreateTimeSlot(eventId: Ref<string>) {
export function useCreateTimeSlot(orgId: Ref<string>, eventId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (payload: CreateTimeSlotPayload) => {
const { data } = await apiClient.post<ApiResponse<TimeSlot>>(
`/events/${eventId.value}/time-slots`,
`/organisations/${orgId.value}/events/${eventId.value}/time-slots`,
payload,
)
@@ -49,13 +49,13 @@ export function useCreateTimeSlot(eventId: Ref<string>) {
})
}
export function useUpdateTimeSlot(eventId: Ref<string>) {
export function useUpdateTimeSlot(orgId: Ref<string>, eventId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async ({ id, ...payload }: UpdateTimeSlotPayload & { id: string }) => {
const { data } = await apiClient.put<ApiResponse<TimeSlot>>(
`/events/${eventId.value}/time-slots/${id}`,
`/organisations/${orgId.value}/events/${eventId.value}/time-slots/${id}`,
payload,
)
@@ -67,12 +67,12 @@ export function useUpdateTimeSlot(eventId: Ref<string>) {
})
}
export function useDeleteTimeSlot(eventId: Ref<string>) {
export function useDeleteTimeSlot(orgId: Ref<string>, eventId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (id: string) => {
await apiClient.delete(`/events/${eventId.value}/time-slots/${id}`)
await apiClient.delete(`/organisations/${orgId.value}/events/${eventId.value}/time-slots/${id}`)
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['time-slots', eventId.value] })