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,27 +13,27 @@ interface PaginatedResponse<T> {
data: T[]
}
export function useShiftList(eventId: Ref<string>, sectionId: Ref<string>) {
export function useShiftList(orgId: Ref<string>, eventId: Ref<string>, sectionId: Ref<string>) {
return useQuery({
queryKey: ['shifts', sectionId],
queryFn: async () => {
const { data } = await apiClient.get<PaginatedResponse<Shift>>(
`/events/${eventId.value}/sections/${sectionId.value}/shifts`,
`/organisations/${orgId.value}/events/${eventId.value}/sections/${sectionId.value}/shifts`,
)
return data.data
},
enabled: () => !!eventId.value && !!sectionId.value,
enabled: () => !!orgId.value && !!eventId.value && !!sectionId.value,
})
}
export function useCreateShift(eventId: Ref<string>, sectionId: Ref<string>) {
export function useCreateShift(orgId: Ref<string>, eventId: Ref<string>, sectionId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (payload: CreateShiftPayload) => {
const { data } = await apiClient.post<ApiResponse<Shift>>(
`/events/${eventId.value}/sections/${sectionId.value}/shifts`,
`/organisations/${orgId.value}/events/${eventId.value}/sections/${sectionId.value}/shifts`,
payload,
)
@@ -45,13 +45,13 @@ export function useCreateShift(eventId: Ref<string>, sectionId: Ref<string>) {
})
}
export function useUpdateShift(eventId: Ref<string>, sectionId: Ref<string>) {
export function useUpdateShift(orgId: Ref<string>, eventId: Ref<string>, sectionId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async ({ id, ...payload }: UpdateShiftPayload & { id: string }) => {
const { data } = await apiClient.put<ApiResponse<Shift>>(
`/events/${eventId.value}/sections/${sectionId.value}/shifts/${id}`,
`/organisations/${orgId.value}/events/${eventId.value}/sections/${sectionId.value}/shifts/${id}`,
payload,
)
@@ -63,13 +63,13 @@ export function useUpdateShift(eventId: Ref<string>, sectionId: Ref<string>) {
})
}
export function useDeleteShift(eventId: Ref<string>, sectionId: Ref<string>) {
export function useDeleteShift(orgId: Ref<string>, eventId: Ref<string>, sectionId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (id: string) => {
await apiClient.delete(
`/events/${eventId.value}/sections/${sectionId.value}/shifts/${id}`,
`/organisations/${orgId.value}/events/${eventId.value}/sections/${sectionId.value}/shifts/${id}`,
)
},
onSuccess: () => {
@@ -78,13 +78,13 @@ export function useDeleteShift(eventId: Ref<string>, sectionId: Ref<string>) {
})
}
export function useAssignShift(eventId: Ref<string>, sectionId: Ref<string>) {
export function useAssignShift(orgId: Ref<string>, eventId: Ref<string>, sectionId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async ({ shiftId, personId }: { shiftId: string; personId: string }) => {
const { data } = await apiClient.post<ApiResponse<unknown>>(
`/events/${eventId.value}/sections/${sectionId.value}/shifts/${shiftId}/assign`,
`/organisations/${orgId.value}/events/${eventId.value}/sections/${sectionId.value}/shifts/${shiftId}/assign`,
{ person_id: personId },
)