From f22af90c09926192ff17c77755c0359c7e0c072f Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 28 Jun 2016 12:09:58 +0200 Subject: Hide revert button when no permission to revert --- apps/files_versions/lib/Storage.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'apps/files_versions/lib') diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 93f8b848ce8..6345d4c303b 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -320,8 +320,16 @@ class Storage { // add expected leading slash $file = '/' . ltrim($file, '/'); list($uid, $filename) = self::getUidAndFilename($file); + if ($uid === null || trim($filename, '/') === '') { + return false; + } $users_view = new View('/'.$uid); $files_view = new View('/'. User::getUser().'/files'); + + if (!$files_view->isUpdatable($filename)) { + return false; + } + $versionCreated = false; //first create a new version -- cgit v1.2.3