From 7669e0482307951abf99c0d2d7e9ff41b0bf0eb9 Mon Sep 17 00:00:00 2001 From: Grigory Vodyanov Date: Wed, 29 Jul 2026 11:32:08 +0200 Subject: [PATCH] fix: calendar delegation Signed-off-by: Grigory Vodyanov --- lib/DAV/CalendarPlugin.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/DAV/CalendarPlugin.php b/lib/DAV/CalendarPlugin.php index e7c9ab6b20..1ce8447fbc 100644 --- a/lib/DAV/CalendarPlugin.php +++ b/lib/DAV/CalendarPlugin.php @@ -15,6 +15,8 @@ class CalendarPlugin implements ICalendarProvider { + private const USER_PRINCIPAL_PREFIX = 'principals/users/'; + /** @var DeckCalendarBackend */ private $backend; /** @var ConfigService */ @@ -33,7 +35,7 @@ public function getAppId(): string { } public function fetchAllForCalendarHome(string $principalUri): array { - if (!$this->calendarIntegrationEnabled) { + if (!$this->calendarIntegrationEnabled || !$this->isOwnCalendarHome($principalUri)) { return []; } @@ -46,7 +48,7 @@ public function fetchAllForCalendarHome(string $principalUri): array { } public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool { - if (!$this->calendarIntegrationEnabled) { + if (!$this->calendarIntegrationEnabled || !$this->isOwnCalendarHome($principalUri)) { return false; } @@ -71,4 +73,10 @@ public function getCalendarInCalendarHome(string $principalUri, string $calendar } return null; } + + private function isOwnCalendarHome(string $principalUri): bool { + $userId = $this->configService->getUserId(); + + return $userId !== null && $principalUri === self::USER_PRINCIPAL_PREFIX . $userId; + } }