aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Calendar
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-11-03 12:19:47 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-11-03 12:19:47 +0100
commit3ef6a099a3d3a3a9baaa48188d316c8295067974 (patch)
tree64b16a0babf4d958598c106dd3d84543de2a7a0b /lib/private/Calendar
parent5705af29a5a06c78d0b36dcee5047ba893e7e867 (diff)
downloadnextcloud-server-3ef6a099a3d3a3a9baaa48188d316c8295067974.tar.gz
nextcloud-server-3ef6a099a3d3a3a9baaa48188d316c8295067974.zip
Add IManager::getCalendarsForPrincipal API
The Calendar app needs to access calendars of a given principal in the back-end. The new calendar providers were not accessible for apps before this patch. Now they can access the ICalendar objects on demand. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Calendar')
-rw-r--r--lib/private/Calendar/Manager.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php
index 3fa4b55d1ea..16e142264aa 100644
--- a/lib/private/Calendar/Manager.php
+++ b/lib/private/Calendar/Manager.php
@@ -167,15 +167,14 @@ class Manager implements IManager {
$this->calendarLoaders = [];
}
- public function searchForPrincipal(ICalendarQuery $query): array {
+ public function getCalendarsForPrincipal(string $principalUri, array $calendarUris = []): array {
$context = $this->coordinator->getRegistrationContext();
if ($context === null) {
return [];
}
- /** @var CalendarQuery $query */
- $calendars = array_merge(
- ...array_map(function ($registration) use ($query) {
+ return array_merge(
+ ...array_map(function ($registration) use ($principalUri, $calendarUris) {
try {
/** @var ICalendarProvider $provider */
$provider = $this->container->get($registration->getService());
@@ -186,9 +185,17 @@ class Manager implements IManager {
return [];
}
- return $provider->getCalendars($query->getPrincipalUri(), $query->getCalendarUris());
+ return $provider->getCalendars($principalUri, $calendarUris);
}, $context->getCalendarProviders())
);
+ }
+
+ public function searchForPrincipal(ICalendarQuery $query): array {
+ /** @var CalendarQuery $query */
+ $calendars = $this->getCalendarsForPrincipal(
+ $query->getPrincipalUri(),
+ $query->getCalendarUris(),
+ );
$results = [];
/** @var ICalendar $calendar */