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

@@ -62,7 +62,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson("/api/v1/events/{$this->festival->id}/sections/registration-settings");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings");
$response->assertOk()
->assertJsonCount(2, 'data');
@@ -92,7 +92,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$response = $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'Theatertent Bar',
'show_in_registration' => true,
'registration_description' => 'Bediening in de overdekte theatertent',
@@ -121,7 +121,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'EHBO',
'show_in_registration' => true,
'registration_description' => null,
@@ -143,7 +143,7 @@ class RegistrationSettingsTest extends TestCase
]);
// Unauthenticated
$response = $this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$response = $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'Bar',
'show_in_registration' => true,
'registration_description' => null,
@@ -156,7 +156,7 @@ class RegistrationSettingsTest extends TestCase
{
Sanctum::actingAs($this->orgAdmin);
$response = $this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$response = $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'Nonexistent Section',
'show_in_registration' => true,
'registration_description' => null,
@@ -167,7 +167,7 @@ class RegistrationSettingsTest extends TestCase
public function test_get_requires_authentication(): void
{
$response = $this->getJson("/api/v1/events/{$this->festival->id}/sections/registration-settings");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings");
$response->assertUnauthorized();
}
@@ -187,7 +187,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson("/api/v1/events/{$flatEvent->id}/sections/registration-settings");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$flatEvent->id}/sections/registration-settings");
$response->assertOk()
->assertJsonCount(1, 'data')