]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check node permissions when restoring a version
authorLouis Chemineau <louis@chmn.me>
Tue, 13 Feb 2024 11:51:01 +0000 (12:51 +0100)
committerLouis Chemineau <louis@chmn.me>
Wed, 21 Feb 2024 14:06:01 +0000 (15:06 +0100)
Signed-off-by: Louis Chemineau <louis@chmn.me>
apps/files_versions/lib/Versions/LegacyVersionsBackend.php

index fe7f41e81550f4a56bf3711ae4799b604025578a..a591c2ae61ffeff1ffc106ff61ef4abe1e7fd144 100644 (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());
        }