summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-02-20 08:57:31 +0100
committerGitHub <noreply@github.com>2024-02-20 08:57:31 +0100
commitf1fe3be31e3be7bad9a411e8ceef5f0642880a42 (patch)
tree11c26a6626b069c3d3bdc645c6c2003c0057a272 /apps/dav
parent1a3e53462020bf88f9b5831cd76e80c0f3a355f0 (diff)
parent8cce736dcb30d0bd2887672f26e4a2466c4cd92b (diff)
downloadnextcloud-server-f1fe3be31e3be7bad9a411e8ceef5f0642880a42.tar.gz
nextcloud-server-f1fe3be31e3be7bad9a411e8ceef5f0642880a42.zip
Merge pull request #43664 from nextcloud/perf/early-exit-report
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/Connector/Sabre/DavAclPlugin.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
index e643304ecec..61fac7250bc 100644
--- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
@@ -8,6 +8,7 @@
* @author Robin Appelman <robin@icewind.nl>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license AGPL-3.0
*
@@ -109,11 +110,15 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
parent::beforeMethod($request, $response);
- $createAddressbookOrCalendarRequest = ($request->getMethod() === 'MKCALENDAR' || $request->getMethod() === 'MKCOL')
- && (str_starts_with($path, 'addressbooks/') || str_starts_with($path, 'calendars/'));
+ if (!str_starts_with($path, 'addressbooks/') && !str_starts_with($path, 'calendars/')) {
+ return;
+ }
- if ($createAddressbookOrCalendarRequest) {
- [$parentName] = \Sabre\Uri\split($path);
+ [$parentName] = \Sabre\Uri\split($path);
+ if ($request->getMethod() === 'REPORT') {
+ // is calendars/users/bob or addressbooks/users/bob readable?
+ $this->checkPrivileges($parentName, '{DAV:}read');
+ } elseif ($request->getMethod() === 'MKCALENDAR' || $request->getMethod() === 'MKCOL') {
// is calendars/users/bob or addressbooks/users/bob writeable?
$this->checkPrivileges($parentName, '{DAV:}write');
}