aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/Trashbin
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-06-02 16:00:29 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-06-02 18:10:07 +0200
commitf1444eac5d6cf64f0700732b47f53919e9ff7c1a (patch)
tree6fbaadd7d94f05557cc5c4d25883fa5dfe72ed67 /apps/dav/lib/CalDAV/Trashbin
parent6578a934636fa0cd6a94d2738b9c2fc0cd4cca30 (diff)
downloadnextcloud-server-f1444eac5d6cf64f0700732b47f53919e9ff7c1a.tar.gz
nextcloud-server-f1444eac5d6cf64f0700732b47f53919e9ff7c1a.zip
Export the CalDAV trash bin retention duration as property
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/CalDAV/Trashbin')
-rw-r--r--apps/dav/lib/CalDAV/Trashbin/Plugin.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/Trashbin/Plugin.php b/apps/dav/lib/CalDAV/Trashbin/Plugin.php
index fd47e1faa30..93f17cc5b7c 100644
--- a/apps/dav/lib/CalDAV/Trashbin/Plugin.php
+++ b/apps/dav/lib/CalDAV/Trashbin/Plugin.php
@@ -27,6 +27,7 @@ namespace OCA\DAV\CalDAV\Trashbin;
use Closure;
use OCA\DAV\CalDAV\Calendar;
+use OCA\DAV\CalDAV\RetentionService;
use OCP\IRequest;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\INode;
@@ -41,15 +42,21 @@ use function implode;
class Plugin extends ServerPlugin {
public const PROPERTY_DELETED_AT = '{http://nextcloud.com/ns}deleted-at';
public const PROPERTY_CALENDAR_URI = '{http://nextcloud.com/ns}calendar-uri';
+ public const PROPERTY_RETENTION_DURATION = '{http://nextcloud.com/ns}trash-bin-retention-duration';
/** @var bool */
private $disableTrashbin;
+ /** @var RetentionService */
+ private $retentionService;
+
/** @var Server */
private $server;
- public function __construct(IRequest $request) {
+ public function __construct(IRequest $request,
+ RetentionService $retentionService) {
$this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1';
+ $this->retentionService = $retentionService;
}
public function initialize(Server $server): void {
@@ -100,6 +107,11 @@ class Plugin extends ServerPlugin {
return $node->getCalendarUri();
});
}
+ if ($node instanceof TrashbinHome) {
+ $propFind->handle(self::PROPERTY_RETENTION_DURATION, function () use ($node) {
+ return $this->retentionService->getDuration();
+ });
+ }
}
public function getFeatures(): array {