diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-07-10 18:30:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 18:30:41 +0200 |
commit | ff86e8c411c8e2edfc648dcc68942a21f65cea7b (patch) | |
tree | 2c85fa40724a181c0f8c5b8f1a5670140614f491 /apps/dav/lib/Connector | |
parent | d3f50f28e14eabc317417450c0f932f71a291d38 (diff) | |
parent | 8e00afbb470dea73c881c5675924079dc1915f69 (diff) | |
download | nextcloud-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.php | 15 |
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'); } } } |