Skip to content

Commit 7669e04

Browse files
committed
fix: calendar delegation
Signed-off-by: Grigory Vodyanov <scratchx@gmx.com>
1 parent f890d3b commit 7669e04

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎lib/DAV/CalendarPlugin.php‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
class CalendarPlugin implements ICalendarProvider {
1717

18+
private const USER_PRINCIPAL_PREFIX = 'principals/users/';
19+
1820
/** @var DeckCalendarBackend */
1921
private $backend;
2022
/** @var ConfigService */
@@ -33,7 +35,7 @@ public function getAppId(): string {
3335
}
3436

3537
public function fetchAllForCalendarHome(string $principalUri): array {
36-
if (!$this->calendarIntegrationEnabled) {
38+
if (!$this->calendarIntegrationEnabled || !$this->isOwnCalendarHome($principalUri)) {
3739
return [];
3840
}
3941

@@ -46,7 +48,7 @@ public function fetchAllForCalendarHome(string $principalUri): array {
4648
}
4749

4850
public function hasCalendarInCalendarHome(string $principalUri, string $calendarUri): bool {
49-
if (!$this->calendarIntegrationEnabled) {
51+
if (!$this->calendarIntegrationEnabled || !$this->isOwnCalendarHome($principalUri)) {
5052
return false;
5153
}
5254

@@ -71,4 +73,10 @@ public function getCalendarInCalendarHome(string $principalUri, string $calendar
7173
}
7274
return null;
7375
}
76+
77+
private function isOwnCalendarHome(string $principalUri): bool {
78+
$userId = $this->configService->getUserId();
79+
80+
return $userId !== null && $principalUri === self::USER_PRINCIPAL_PREFIX . $userId;
81+
}
7482
}

0 commit comments

Comments
 (0)