From 82906c7cd735033b462fff04c2411cd93d2534f4 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Sun, 17 Jul 2016 00:53:12 +0530 Subject: [PATCH] No need to make the user login here, and fix incorrect userid Setting up FS is enough to get the correct file version. No need to make the user login here. File version would be in owner's FS, not editor, so s/editorid/ownerid/ --- controller/documentcontroller.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/controller/documentcontroller.php b/controller/documentcontroller.php index 87ee52de..56167e8c 100644 --- a/controller/documentcontroller.php +++ b/controller/documentcontroller.php @@ -469,23 +469,11 @@ class DocumentController extends Controller { if ($version !== '0') { \OCP\JSON::checkAppEnabled('files_versions'); - // Login as this user - $editorid = $res['editor']; - $users = \OC::$server->getUserManager()->search($editorid, 1, 0); - if (count($users) > 0) - { - $user = array_shift($users); - if (strcasecmp($user->getUID(),$editorid) === 0) - { - \OC::$server->getUserSession()->setUser($user); - } - } - - \OCP\JSON::checkLoggedIn(); + $ownerid = $res['owner']; // Setup the FS \OC_Util::tearDownFS(); - \OC_Util::setupFS($editorid, '/' . $editorid . '/files'); + \OC_Util::setupFS($ownerid, '/' . $ownerid . '/files'); list($owner_uid, $filename) = \OCA\Files_Versions\Storage::getUidAndFilename($res['path']); $versionName = '/files_versions/' . $filename . '.v' . $version;