Skip to content

Commit 2e273e4

Browse files
Merge pull request #46225 from nextcloud/fix/issue-11633
fix(dav): Thrown forbidden error for authenticated user instead of no…
2 parents bc531be + f5fcfb4 commit 2e273e4

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

apps/dav/lib/Connector/Sabre/DavAclPlugin.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use OCA\DAV\CalDAV\Calendar;
1212
use OCA\DAV\CardDAV\AddressBook;
1313
use Sabre\CalDAV\Principal\User;
14+
use Sabre\DAV\Exception\Forbidden;
1415
use Sabre\DAV\Exception\NotFound;
1516
use Sabre\DAV\INode;
1617
use Sabre\DAV\PropFind;
@@ -49,13 +50,19 @@ public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT,
4950
$type = 'Node';
5051
break;
5152
}
52-
throw new NotFound(
53-
sprintf(
54-
"%s with name '%s' could not be found",
55-
$type,
56-
$node->getName()
57-
)
58-
);
53+
54+
if ($this->getCurrentUserPrincipal() === $node->getOwner()) {
55+
throw new Forbidden("Access denied");
56+
} else {
57+
throw new NotFound(
58+
sprintf(
59+
"%s with name '%s' could not be found",
60+
$type,
61+
$node->getName()
62+
)
63+
);
64+
}
65+
5966
}
6067

6168
return $access;

0 commit comments

Comments
 (0)