fix: apply the booking horizon to admins as well

This commit is contained in:
fromme committed 2026-09-18 10:54:01 +02:00
1 parent 2f5d1d14e4
commit 867bd413c8
4 files changed
+16 -19

No files matched your search

+9 -2
View File
@@ -522,14 +522,21 @@ class BookingControllerTest extends WebTestCase
self::assertStringContainsString('höchstens 3 Monate in die Zukunft', (string) $response->getContent());
}
public function testAnAdminIsNotBoundByTheHorizon(): void
/**
* The horizon used to be lifted for ROLE_ADMIN on the grounds that an admin books for other
* people. They do not -- this modal always books for whoever is using it, and the admin area
* is read-only -- so the exemption only let an admin block a desk for themselves half a year
* ahead.
*/
public function testAnAdminIsBoundByTheHorizonToo(): void
{
$this->client->loginUser($this->admin('[email protected]'));
$beyond = BookingHorizon::latest()->modify('+2 months');
$response = $this->submitBookingModal($this->resource('D1'), $beyond->format('Y-m-d'), ['allDay' => '1']);
self::assertSame(Response::HTTP_OK, $response->getStatusCode());
self::assertSame(Response::HTTP_UNPROCESSABLE_ENTITY, $response->getStatusCode());
self::assertStringContainsString('höchstens 3 Monate im Voraus', (string) $response->getContent());
}
/**