aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastianKrupinski <krupinskis05@gmail.com>2024-07-01 11:48:02 -0400
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-07-19 17:01:24 +0000
commit3c8106d511ac9865ba17caadd24324ce7f2fca04 (patch)
treed21f325e58c6d3f5877abb0dc62932c300967520
parent63a4884bb2ab8adfa0c5dab277caaf7012de1b99 (diff)
downloadnextcloud-server-3c8106d511ac9865ba17caadd24324ce7f2fca04.tar.gz
nextcloud-server-3c8106d511ac9865ba17caadd24324ce7f2fca04.zip
fix(dav): Thrown forbidden error for authenticated user instead of not found
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
-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 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;