aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-07-10 18:30:41 +0200
committerGitHub <noreply@github.com>2023-07-10 18:30:41 +0200
commitff86e8c411c8e2edfc648dcc68942a21f65cea7b (patch)
tree2c85fa40724a181c0f8c5b8f1a5670140614f491 /apps/dav/lib/Connector
parentd3f50f28e14eabc317417450c0f932f71a291d38 (diff)
parent8e00afbb470dea73c881c5675924079dc1915f69 (diff)
downloadnextcloud-server-ff86e8c411c8e2edfc648dcc68942a21f65cea7b.tar.gz
nextcloud-server-ff86e8c411c8e2edfc648dcc68942a21f65cea7b.zip
Merge pull request #38968 from nextcloud/backport/38747/stable27
[stable27] perf: skip request without write permission
Diffstat (limited to 'apps/dav/lib/Connector')
-rw-r--r--apps/dav/lib/Connector/Sabre/DavAclPlugin.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
index 6842975835d..7fa94d7b903 100644
--- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
@@ -94,8 +94,19 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
$path = $request->getPath();
// prevent the plugin from causing an unneeded overhead for file requests
- if (strpos($path, 'files/') !== 0) {
- parent::beforeMethod($request, $response);
+ if (str_starts_with($path, 'files/')) {
+ return;
+ }
+
+ parent::beforeMethod($request, $response);
+
+ $createAddressbookOrCalendarRequest = ($request->getMethod() === 'MKCALENDAR' || $request->getMethod() === 'MKCOL')
+ && (str_starts_with($path, 'addressbooks/') || str_starts_with($path, 'calendars/'));
+
+ if ($createAddressbookOrCalendarRequest) {
+ [$parentName] = \Sabre\Uri\split($path);
+ // is calendars/users/bob or addressbooks/users/bob writeable?
+ $this->checkPrivileges($parentName, '{DAV:}write');
}
}
}