aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
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 15:06:01 +0100
commit37d0fd109a921d760d621a4f0a11cf05c9c7211f (patch)
tree975dc33cc66bca14245cc9e86fad37aa36e70339 /apps/files_versions/lib
parent741dec283fe1aa3e19a9b525a1a8abc70261a5dc (diff)
downloadnextcloud-server-37d0fd109a921d760d621a4f0a11cf05c9c7211f.tar.gz
nextcloud-server-37d0fd109a921d760d621a4f0a11cf05c9c7211f.zip
Check node permissions when restoring a version
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_versions/lib')
-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 fe7f41e8155..a591c2ae61f 100644
--- a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
+++ b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
@@ -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());
}