diff options
author | Louis Chemineau <louis@chmn.me> | 2024-02-21 14:34:12 +0100 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2024-02-21 15:09:33 +0100 |
commit | 046b8f320f2ce1c37f658130ec84071218262deb (patch) | |
tree | 98115cad902f7f80b3d3f48e2f4a38e5ab0ee56a /apps/files_versions/lib | |
parent | 37d0fd109a921d760d621a4f0a11cf05c9c7211f (diff) | |
download | nextcloud-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.php | 4 |
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(), |