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

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { useAssignShift } from '@/composables/api/useShifts'
import { usePersonList } from '@/composables/api/usePersons'
import { useAuthStore } from '@/stores/useAuthStore'
import type { Shift } from '@/types/section'
import type { Person } from '@/types/person'
@@ -12,12 +13,14 @@ const props = defineProps<{
const modelValue = defineModel<boolean>({ required: true })
const authStore = useAuthStore()
const orgIdRef = computed(() => authStore.currentOrganisation?.id ?? '')
const eventIdRef = computed(() => props.eventId)
const sectionIdRef = computed(() => props.sectionId)
const approvedFilter = ref({ status: 'approved' })
const { data: personsResponse } = usePersonList(eventIdRef, approvedFilter)
const { mutate: assignShift, isPending } = useAssignShift(eventIdRef, sectionIdRef)
const { data: personsResponse } = usePersonList(orgIdRef, eventIdRef, approvedFilter)
const { mutate: assignShift, isPending } = useAssignShift(orgIdRef, eventIdRef, sectionIdRef)
const persons = computed(() => personsResponse.value?.data ?? [])

View File

@@ -39,7 +39,7 @@ const form = ref({
const errors = ref<Record<string, string>>({})
const refVForm = ref<VForm>()
const { mutate: createSection, isPending } = useCreateSection(eventIdRef)
const { mutate: createSection, isPending } = useCreateSection(orgId, eventIdRef)
const typeOptions = [
{ title: 'Standaard', value: 'standard' },

View File

@@ -2,6 +2,7 @@
import { VForm } from 'vuetify/components/VForm'
import { useCreateShift, useUpdateShift } from '@/composables/api/useShifts'
import { useTimeSlotList } from '@/composables/api/useTimeSlots'
import { useAuthStore } from '@/stores/useAuthStore'
import { requiredValidator } from '@core/utils/validators'
import type { Shift, ShiftStatus } from '@/types/section'
@@ -18,16 +19,18 @@ const modelValue = defineModel<boolean>({ required: true })
const router = useRouter()
const route = useRoute()
const authStore = useAuthStore()
const orgIdRef = computed(() => authStore.currentOrganisation?.id ?? '')
const eventIdRef = computed(() => props.eventId)
const sectionIdRef = computed(() => props.sectionId)
const isEditing = computed(() => !!props.shift)
const isSubEventRef = computed(() => props.isSubEvent)
const { data: timeSlots } = useTimeSlotList(eventIdRef, { includeParent: isSubEventRef })
const { mutate: createShift, isPending: isCreating } = useCreateShift(eventIdRef, sectionIdRef)
const { mutate: updateShift, isPending: isUpdating } = useUpdateShift(eventIdRef, sectionIdRef)
const { data: timeSlots } = useTimeSlotList(orgIdRef, eventIdRef, { includeParent: isSubEventRef })
const { mutate: createShift, isPending: isCreating } = useCreateShift(orgIdRef, eventIdRef, sectionIdRef)
const { mutate: updateShift, isPending: isUpdating } = useUpdateShift(orgIdRef, eventIdRef, sectionIdRef)
const isPending = computed(() => isCreating.value || isUpdating.value)

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { VForm } from 'vuetify/components/VForm'
import { useCreateTimeSlot, useUpdateTimeSlot } from '@/composables/api/useTimeSlots'
import { useAuthStore } from '@/stores/useAuthStore'
import { requiredValidator } from '@core/utils/validators'
import type { TimeSlot } from '@/types/section'
@@ -12,6 +13,8 @@ const props = defineProps<{
const modelValue = defineModel<boolean>({ required: true })
const authStore = useAuthStore()
const orgIdRef = computed(() => authStore.currentOrganisation?.id ?? '')
const eventIdRef = computed(() => props.eventId)
const isEditing = computed(() => !!props.timeSlot)
@@ -28,8 +31,8 @@ const form = ref({
const errors = ref<Record<string, string>>({})
const refVForm = ref<VForm>()
const { mutate: createTimeSlot, isPending: isCreating } = useCreateTimeSlot(eventIdRef)
const { mutate: updateTimeSlot, isPending: isUpdating } = useUpdateTimeSlot(eventIdRef)
const { mutate: createTimeSlot, isPending: isCreating } = useCreateTimeSlot(orgIdRef, eventIdRef)
const { mutate: updateTimeSlot, isPending: isUpdating } = useUpdateTimeSlot(orgIdRef, eventIdRef)
const isPending = computed(() => isCreating.value || isUpdating.value)

View File

@@ -35,7 +35,7 @@ const form = ref({
const errors = ref<Record<string, string>>({})
const refVForm = ref<VForm>()
const { mutate: updateSection, isPending } = useUpdateSection(eventIdRef)
const { mutate: updateSection, isPending } = useUpdateSection(orgId, eventIdRef)
const typeOptions = [
{ title: 'Standaard', value: 'standard' },

View File

@@ -2,6 +2,7 @@
import draggable from 'vuedraggable'
import { useSectionList, useDeleteSection, useReorderSections } from '@/composables/api/useSections'
import { useShiftList, useDeleteShift } from '@/composables/api/useShifts'
import { useAuthStore } from '@/stores/useAuthStore'
import CreateSectionDialog from '@/components/sections/CreateSectionDialog.vue'
import EditSectionDialog from '@/components/sections/EditSectionDialog.vue'
import CreateShiftDialog from '@/components/sections/CreateShiftDialog.vue'
@@ -11,17 +12,19 @@ import { useShiftDetailStore } from '@/stores/useShiftDetailStore'
import type { FestivalSection, Shift, ShiftStatus } from '@/types/section'
const shiftDetailStore = useShiftDetailStore()
const authStore = useAuthStore()
const props = defineProps<{
eventId: string
isSubEvent?: boolean
}>()
const orgIdRef = computed(() => authStore.currentOrganisation?.id ?? '')
const eventIdRef = computed(() => props.eventId)
// --- Section list ---
const { data: sectionsQuery, isLoading: sectionsLoading } = useSectionList(eventIdRef)
const { mutate: reorderSections } = useReorderSections(eventIdRef)
const { data: sectionsQuery, isLoading: sectionsLoading } = useSectionList(orgIdRef, eventIdRef)
const { mutate: reorderSections } = useReorderSections(orgIdRef, eventIdRef)
// Local ref for draggable — synced from query but not overwritten during drag
const sections = ref<FestivalSection[]>([])
@@ -57,14 +60,14 @@ const activeSectionEventId = computed(() => {
})
const activeSectionEventIdRef = computed(() => activeSectionEventId.value)
const { mutate: deleteSection } = useDeleteSection(activeSectionEventIdRef)
const { mutate: deleteSection } = useDeleteSection(orgIdRef, activeSectionEventIdRef)
// --- Shifts for active section ---
const activeSectionIdRef = computed(() => activeSectionId.value ?? '')
const { data: shifts, isLoading: shiftsLoading } = useShiftList(activeSectionEventIdRef, activeSectionIdRef)
const { mutate: deleteShiftMutation, isPending: isDeleting } = useDeleteShift(activeSectionEventIdRef, activeSectionIdRef)
const { data: shifts, isLoading: shiftsLoading } = useShiftList(orgIdRef, activeSectionEventIdRef, activeSectionIdRef)
const { mutate: deleteShiftMutation, isPending: isDeleting } = useDeleteShift(orgIdRef, activeSectionEventIdRef, activeSectionIdRef)
// Group shifts by time_slot_id
const shiftsByTimeSlot = computed(() => {