From eef417f05bf942a3b658bbd0db0b94d9fed3f53f Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Wed, 17 May 2017 15:57:15 +0530 Subject: [PATCH] Support opening encrypted files --- lib/Controller/DocumentController.php | 7 +++++++ lib/Controller/WopiController.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Controller/DocumentController.php b/lib/Controller/DocumentController.php index eb05986a..d854945b 100644 --- a/lib/Controller/DocumentController.php +++ b/lib/Controller/DocumentController.php @@ -116,6 +116,13 @@ class DocumentController extends Controller { 'instanceId' => $this->settings->getSystemValue('instanceid'), ]; + // Update the current file to be accessible with system public shared key + $owner = $item->getOwner()->getUID(); + $absPath = '/' . $owner . '/' . $item->getInternalPath(); + $accessList = \OC::$server->getEncryptionFilesHelper()->getAccessList($absPath); + $accessList['public'] = true; + \OC::$server->getEncryptionManager()->getEncryptionModule()->update($absPath, $owner, $accessList); + $response = new TemplateResponse('richdocuments', 'documents', $params, 'empty'); $policy = new ContentSecurityPolicy(); $policy->addAllowedFrameDomain($this->appConfig->getAppValue('wopi_url')); diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php index 3c810ca6..72f5b57e 100644 --- a/lib/Controller/WopiController.php +++ b/lib/Controller/WopiController.php @@ -120,7 +120,7 @@ class WopiController extends Controller { /** @var File $file */ $userFolder = $this->rootFolder->getUserFolder($res['owner']); $file = $userFolder->getById($fileId)[0]; - + \OC_User::setIncognitoMode(true); if ($version !== '0') { $view = new View('/' . $res['owner'] . '/files');