Skip to content

Commit

Permalink
fix: Check for update permissions when creating a new file
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Oct 16, 2024
1 parent 3a53888 commit d0b6ad1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Controller/DocumentAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public function create(string $mimeType, string $fileName, string $directoryPath
try {
if ($shareToken !== null) {
$share = $this->shareManager->getShareByToken($shareToken);
if (!($share->getPermissions() & \OCP\Constants::PERMISSION_CREATE)) {
return new JSONResponse([
'status' => 'error',
'message' => $this->l10n->t('Not allowed to create document')
], Http::STATUS_FORBIDDEN);
}
}

$rootFolder = $shareToken !== null ? $share->getNode() : $this->rootFolder->getUserFolder($this->userId);
Expand Down

0 comments on commit d0b6ad1

Please sign in to comment.