Skip to content

Commit 23c4bb1

Browse files
Merge pull request #46646 from nextcloud/backport/46225/stable29
[stable29] fix(dav): Thrown forbidden error for authenticated user instead of no…
2 parents 63a4884 + 3c8106d commit 23c4bb1

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use OCA\DAV\CalDAV\Calendar;
3232
use OCA\DAV\CardDAV\AddressBook;
3333
use Sabre\CalDAV\Principal\User;
34+
use Sabre\DAV\Exception\Forbidden;
3435
use Sabre\DAV\Exception\NotFound;
3536
use Sabre\DAV\INode;
3637
use Sabre\DAV\PropFind;
@@ -69,13 +70,19 @@ public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT,
6970
$type = 'Node';
7071
break;
7172
}
72-
throw new NotFound(
73-
sprintf(
74-
"%s with name '%s' could not be found",
75-
$type,
76-
$node->getName()
77-
)
78-
);
73+
74+
if ($this->getCurrentUserPrincipal() === $node->getOwner()) {
75+
throw new Forbidden("Access denied");
76+
} else {
77+
throw new NotFound(
78+
sprintf(
79+
"%s with name '%s' could not be found",
80+
$type,
81+
$node->getName()
82+
)
83+
);
84+
}
85+
7986
}
8087

8188
return $access;

0 commit comments

Comments
 (0)