aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/CalDAV/CachedSubscriptionImpl.php')
-rw-r--r--apps/dav/lib/CalDAV/CachedSubscriptionImpl.php46
1 files changed, 24 insertions, 22 deletions
diff --git a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php
index 3f6eff4e1f4..cc1bab6d4fc 100644
--- a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php
+++ b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php
@@ -9,22 +9,19 @@ declare(strict_types=1);
namespace OCA\DAV\CalDAV;
use OCP\Calendar\ICalendar;
+use OCP\Calendar\ICalendarIsEnabled;
+use OCP\Calendar\ICalendarIsShared;
+use OCP\Calendar\ICalendarIsWritable;
use OCP\Constants;
-class CachedSubscriptionImpl implements ICalendar {
- private CalDavBackend $backend;
- private CachedSubscription $calendar;
- /** @var array<string, mixed> */
- private array $calendarInfo;
+class CachedSubscriptionImpl implements ICalendar, ICalendarIsEnabled, ICalendarIsShared, ICalendarIsWritable {
public function __construct(
- CachedSubscription $calendar,
- array $calendarInfo,
- CalDavBackend $backend
+ private CachedSubscription $calendar,
+ /** @var array<string, mixed> */
+ private array $calendarInfo,
+ private CalDavBackend $backend,
) {
- $this->calendar = $calendar;
- $this->calendarInfo = $calendarInfo;
- $this->backend = $backend;
}
/**
@@ -32,7 +29,7 @@ class CachedSubscriptionImpl implements ICalendar {
* @since 13.0.0
*/
public function getKey(): string {
- return (string) $this->calendarInfo['id'];
+ return (string)$this->calendarInfo['id'];
}
/**
@@ -58,16 +55,6 @@ class CachedSubscriptionImpl implements ICalendar {
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
}
- /**
- * @param string $pattern which should match within the $searchProperties
- * @param array $searchProperties defines the properties within the query pattern should match
- * @param array $options - optional parameters:
- * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
- * @param int|null $limit - limit number of search results
- * @param int|null $offset - offset for paging of search results
- * @return array an array of events/journals/todos which are arrays of key-value-pairs
- * @since 13.0.0
- */
public function search(string $pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null): array {
return $this->backend->search($this->calendarInfo, $pattern, $searchProperties, $options, $limit, $offset);
}
@@ -90,10 +77,25 @@ class CachedSubscriptionImpl implements ICalendar {
return $result;
}
+ /**
+ * @since 32.0.0
+ */
+ public function isEnabled(): bool {
+ return $this->calendarInfo['{http://owncloud.org/ns}calendar-enabled'] ?? true;
+ }
+
+ public function isWritable(): bool {
+ return false;
+ }
+
public function isDeleted(): bool {
return false;
}
+ public function isShared(): bool {
+ return true;
+ }
+
public function getSource(): string {
return $this->calendarInfo['source'];
}