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/
This commit is contained in:
Pranav Kant 2016-07-17 00:53:12 +05:30
parent e0da6fa8d1
commit 82906c7cd7

View File

@ -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;