summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-13 12:51:01 +0100
committerLouis Chemineau <louis@chmn.me>2024-02-21 21:47:50 +0100
commitd8026de6b38aeacdc8a409339b7cc77f99835789 (patch)
tree54d9e521170555bb191a72d24df29b329b27acf5 /apps/files_versions
parentb48b153ac683789bdeecbb3ad66cef9cf37fef38 (diff)
downloadnextcloud-server-d8026de6b38aeacdc8a409339b7cc77f99835789.tar.gz
nextcloud-server-d8026de6b38aeacdc8a409339b7cc77f99835789.zip
Check node permissions when restoring a version
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/Versions/LegacyVersionsBackend.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
index 3ae6d31a428..85ad0cd671d 100644
--- a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
+++ b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
@@ -179,6 +179,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());
}