Пример #1
0
 public function updateDocument(Document $document, $title, $plainContent, User $updater, $passPhrase)
 {
     $share = $document->getShareOf($updater);
     if ($share === null) {
         throw new AccessDeniedException('The user does not have access to this document');
     }
     $encryptionKey = $this->getEncryptionKey($share, $passPhrase);
     $encryptedContent = base64_encode(\Crypto::Encrypt($plainContent, $encryptionKey));
     $document->setTitle($title);
     $document->setEncryptedContent($encryptedContent);
     $this->documentRepository->save($document);
 }