コード例 #1
0
ファイル: DocumentService.php プロジェクト: trivago-tgoik/kis
 public function shareDocument(Document $document, User $requester, User $shareWith, $passPhrase)
 {
     $requesterShare = $document->getShareOf($requester);
     if ($requesterShare === null) {
         throw new AccessDeniedException('The user does not have access to this document');
     }
     $encryptionKey = $this->getEncryptionKey($requesterShare, $passPhrase);
     $encryptedKey = KeyGen::encrypt($encryptionKey, $shareWith->getPublicKey());
     $share = $document->shareWith($shareWith, $encryptedKey);
     $this->documentRepository->save($share);
 }