Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2017-05-25 12:47:24 +0300
committerGitHub <noreply@github.com>2017-05-25 12:47:24 +0300
commit75f0423957a67a9fe610845b14214f825d664341 (patch)
treeef017eccac39688803821d8087c0c6199f3e6af7 /lib
parent6d9054e6f3c9edb2787896df29b5850b98a7840d (diff)
parent0f086cfe87294a62f6ae0501c1b55a5011ed71a3 (diff)
Merge pull request #63 from pranavk/usernames
Register the change under user's name when saving the document
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/WopiController.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php
index 3c810ca6..f5ba415e 100644
--- a/lib/Controller/WopiController.php
+++ b/lib/Controller/WopiController.php
@@ -177,6 +177,14 @@ class WopiController extends Controller {
// Setup the FS which is needed to emit hooks (versioning).
\OC_Util::tearDownFS();
\OC_Util::setupFS($res['owner']);
+
+ // Set the user to register the change under his name
+ $editor = \OC::$server->getUserManager()->get($res['editor']);
+ if (is_null($editor)) {
+ throw new \OC\User\NoUserException("User " . $res['editor'] . "not found.");
+ }
+ \OC::$server->getUserSession()->setUser($editor);
+
$file->putContent($content);
return new JSONResponse();
} catch (\Exception $e) {