Merge pull request #43723 from nextcloud/backport/43664/stable26

This commit is contained in:
John Molakvoæ 2024-02-21 17:30:29 +01:00 committed by GitHub
commit c7fb5d80f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
*
@ -100,11 +101,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');
}