0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-15 00:43:23 +00:00

Check node permissions when restoring a version

Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
Louis Chemineau 2024-02-13 12:51:01 +01:00
parent 741dec283f
commit 37d0fd109a
No known key found for this signature in database

View file

@ -178,6 +178,10 @@ class LegacyVersionsBackend implements IVersionBackend, INameableVersionBackend,
}
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());
}