Skip to content

Commit

Permalink
Merge pull request #43722 from nextcloud/backport/43664/stable28
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Feb 21, 2024
2 parents 21bc3a3 + 4adda64 commit dc68447
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions apps/dav/lib/Connector/Sabre/DavAclPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @author Robin Appelman <[email protected]>
* @author Roeland Jago Douma <[email protected]>
* @author Thomas Müller <[email protected]>
* @author Richard Steinmetz <[email protected]>
*
* @license AGPL-3.0
*
Expand Down Expand Up @@ -105,11 +106,15 @@ public function beforeMethod(RequestInterface $request, ResponseInterface $respo

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');
}
Expand Down

0 comments on commit dc68447

Please sign in to comment.