Skip to content

Commit

Permalink
fix(dav): Thrown forbidden error for authenticated user instead of no…
Browse files Browse the repository at this point in the history
…t found

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
  • Loading branch information
SebastianKrupinski authored and backportbot[bot] committed Jul 19, 2024
1 parent 63a4884 commit 3c8106d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions apps/dav/lib/Connector/Sabre/DavAclPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -69,13 +70,19 @@ public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT,
$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;
Expand Down

0 comments on commit 3c8106d

Please sign in to comment.