diff options
author | SebastianKrupinski <krupinskis05@gmail.com> | 2024-07-01 11:48:02 -0400 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-07-19 17:21:18 +0000 |
commit | 5cf9d62c6d43793c7da500727e621bafaf008f57 (patch) | |
tree | 9ba1d960db266ebd4c3acd8b7d3945c8d0b54cae /apps/dav | |
parent | 3aef5ac05cb1db526ab580d25ada81bcca08a5d3 (diff) | |
download | nextcloud-server-5cf9d62c6d43793c7da500727e621bafaf008f57.tar.gz nextcloud-server-5cf9d62c6d43793c7da500727e621bafaf008f57.zip |
fix(dav): Thrown forbidden error for authenticated user instead of not found
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/DavAclPlugin.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php index 8e5000fa9fb..9891a8cab0d 100644 --- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php +++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php @@ -31,6 +31,7 @@ use OCA\DAV\CalDAV\CachedSubscription; use OCA\DAV\CalDAV\Calendar; use OCA\DAV\CardDAV\AddressBook; use Sabre\CalDAV\Principal\User; +use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\INode; use Sabre\DAV\PropFind; @@ -69,13 +70,19 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { $type = 'Node'; break; } - throw new NotFound( - sprintf( - "%s with name '%s' could not be found", - $type, - $node->getName() - ) - ); + + if ($this->getCurrentUserPrincipal() === $node->getOwner()) { + throw new Forbidden("Access denied"); + } else { + throw new NotFound( + sprintf( + "%s with name '%s' could not be found", + $type, + $node->getName() + ) + ); + } + } return $access; |