aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector
diff options
context:
space:
mode:
authorSebastianKrupinski <krupinskis05@gmail.com>2024-07-01 11:48:02 -0400
committerSebastianKrupinski <krupinskis05@gmail.com>2024-07-10 17:58:02 -0400
commitf5fcfb4670f31571e0f0e63f106bb4a57bd489c6 (patch)
treecaf96631d63ed60a7d6fca2ffce5618ec8b3c773 /apps/dav/lib/Connector
parentb97c7dfe7f162680ffd9720ece12cdcd3ab656cd (diff)
downloadnextcloud-server-f5fcfb4670f31571e0f0e63f106bb4a57bd489c6.tar.gz
nextcloud-server-f5fcfb4670f31571e0f0e63f106bb4a57bd489c6.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/lib/Connector')
-rw-r--r--apps/dav/lib/Connector/Sabre/DavAclPlugin.php21
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 c499f806eba..336930cf17d 100644
--- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php
@@ -11,6 +11,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;
@@ -49,13 +50,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;