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

@@ -90,7 +90,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -118,7 +118,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
);
$response->assertOk()
@@ -143,7 +143,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -163,7 +163,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -175,7 +175,7 @@ class AssignablePersonsTest extends TestCase
$shift = $this->createOpenShift();
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertUnauthorized();
@@ -188,7 +188,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->outsider);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertForbidden();
@@ -212,7 +212,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
);
$response->assertOk()
@@ -231,7 +231,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -259,7 +259,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
['person_id' => $person->id],
);
@@ -288,7 +288,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/claim",
['person_id' => $person->id],
);
@@ -316,7 +316,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
);
$response->assertOk()
@@ -348,7 +348,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $person->id],
);
@@ -379,7 +379,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $person->id],
);
@@ -408,7 +408,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
['person_id' => $person->id],
);
@@ -436,7 +436,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -463,7 +463,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -486,7 +486,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -523,7 +523,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -542,7 +542,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -568,7 +568,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -590,7 +590,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -607,7 +607,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -627,7 +627,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -642,7 +642,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -666,7 +666,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -692,7 +692,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()