aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-07-10 17:57:55 +0200
committerGitHub <noreply@github.com>2023-07-10 17:57:55 +0200
commitf4f6a95b029bfc1afca1a912bfd2de071416e671 (patch)
tree5960e426ce7be27c810850ae293149e5f37ef524 /apps/dav/lib
parent48f27a90bdf6d0910e64ddbe6a93f82280ee8376 (diff)
parentf0f4c46545c77bf1ccba343ae4816fd7c7d3d406 (diff)
downloadnextcloud-server-f4f6a95b029bfc1afca1a912bfd2de071416e671.tar.gz
nextcloud-server-f4f6a95b029bfc1afca1a912bfd2de071416e671.zip
Merge pull request #38972 from nextcloud/backport/38747/stable26
[stable26] perf: skip request without write permission
Diffstat (limited to 'apps/dav/lib')
-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');
}
}
}