aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-21 14:34:12 +0100
committerLouis Chemineau <louis@chmn.me>2024-02-21 15:09:33 +0100
commit046b8f320f2ce1c37f658130ec84071218262deb (patch)
tree98115cad902f7f80b3d3f48e2f4a38e5ab0ee56a /apps/files_versions/lib
parent37d0fd109a921d760d621a4f0a11cf05c9c7211f (diff)
downloadnextcloud-server-046b8f320f2ce1c37f658130ec84071218262deb.tar.gz
nextcloud-server-046b8f320f2ce1c37f658130ec84071218262deb.zip
Check permissions when labeling 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 a591c2ae61f..a6bf6c2cb1a 100644
--- a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
+++ b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
@@ -228,6 +228,10 @@ class LegacyVersionsBackend implements IVersionBackend, INameableVersionBackend,
}
public function setVersionLabel(IVersion $version, string $label): void {
+ if (!$this->currentUserHasPermissions($version, \OCP\Constants::PERMISSION_UPDATE)) {
+ throw new Forbidden('You cannot label this version because you do not have update permissions on the source file.');
+ }
+
$versionEntity = $this->versionsMapper->findVersionForFileId(
$version->getSourceFile()->getId(),
$version->getTimestamp(),