aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/DAV
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2024-06-04 15:58:39 +0200
committerRichard Steinmetz <richard@steinmetz.cloud>2024-07-22 15:24:39 +0200
commitcbea7872333974bae8868e7553c06595e5d3d02d (patch)
treecacaa36b654f989903e300d379388df078d14674 /apps/dav/lib/DAV
parent1768bd628052cf3b9db7cb3c1dbee7313ee24c16 (diff)
downloadnextcloud-server-cbea7872333974bae8868e7553c06595e5d3d02d.tar.gz
nextcloud-server-cbea7872333974bae8868e7553c06595e5d3d02d.zip
fix(caldav): stricter default calendar checks
Reject calendars that - are subscriptions - are not writable - are shared with a user - are deleted - don't support VEVENTs Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'apps/dav/lib/DAV')
-rw-r--r--apps/dav/lib/DAV/CustomPropertiesBackend.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php
index f4dd9b2d038..c3a547ab07d 100644
--- a/apps/dav/lib/DAV/CustomPropertiesBackend.php
+++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php
@@ -8,12 +8,13 @@
namespace OCA\DAV\DAV;
use Exception;
+use OCA\DAV\CalDAV\Calendar;
+use OCA\DAV\CalDAV\DefaultCalendarValidator;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IUser;
-use Sabre\CalDAV\ICalendar;
use Sabre\DAV\Exception as DavException;
use Sabre\DAV\PropertyStorage\Backend\BackendInterface;
use Sabre\DAV\PropFind;
@@ -135,6 +136,7 @@ class CustomPropertiesBackend implements BackendInterface {
private Server $server;
private XmlService $xmlService;
+ private DefaultCalendarValidator $defaultCalendarValidator;
/**
* @param Tree $tree node tree
@@ -146,6 +148,7 @@ class CustomPropertiesBackend implements BackendInterface {
Tree $tree,
IDBConnection $connection,
IUser $user,
+ DefaultCalendarValidator $defaultCalendarValidator,
) {
$this->server = $server;
$this->tree = $tree;
@@ -156,6 +159,7 @@ class CustomPropertiesBackend implements BackendInterface {
$this->xmlService->elementMap,
self::COMPLEX_XML_ELEMENT_MAP,
);
+ $this->defaultCalendarValidator = $defaultCalendarValidator;
}
/**
@@ -319,10 +323,11 @@ class CustomPropertiesBackend implements BackendInterface {
// $path is the principal here as this prop is only set on principals
$node = $this->tree->getNodeForPath($href);
- if (!($node instanceof ICalendar) || $node->getOwner() !== $path) {
+ if (!($node instanceof Calendar) || $node->getOwner() !== $path) {
throw new DavException('No such calendar');
}
+ $this->defaultCalendarValidator->validateScheduleDefaultCalendar($node);
break;
}
}