Skip to content

Commit

Permalink
Merge pull request #78 from pranavk/enc
Browse files Browse the repository at this point in the history
Guard encryption support
  • Loading branch information
timar authored May 25, 2017
2 parents 377eeae + c14ff8f commit 35e2464
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,16 @@ public function index($fileId) {
'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);
$encryptionManager = \OC::$server->getEncryptionManager();
if ($encryptionManager->isEnabled())
{
// 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;
$encryptionManager->getEncryptionModule()->update($absPath, $owner, $accessList);
}

$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
$policy = new ContentSecurityPolicy();
Expand Down

0 comments on commit 35e2464

Please sign in to comment.