Skip to content

Commit

Permalink
Check node permissions when restoring a version
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>

[skip ci]
  • Loading branch information
artonge authored and backportbot[bot] committed Feb 27, 2024
1 parent 45acb6d commit 20cec42
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/files_versions/lib/Versions/LegacyVersionsBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public function createVersion(IUser $user, FileInfo $file) {
}

public function rollback(IVersion $version) {
if (!$this->currentUserHasPermissions($version, \OCP\Constants::PERMISSION_UPDATE)) {
throw new Forbidden('You cannot restore this version because you do not have update permissions on the source file.');
}

return Storage::rollback($version->getVersionPath(), $version->getRevisionId(), $version->getUser());
}

Expand Down

0 comments on commit 20cec42

Please sign in to comment.