Esempio n. 1
0
 /**
  * notify encryption module about added/removed users from a file/folder
  *
  * @param string $path relative to data/
  * @throws Exceptions\ModuleDoesNotExistsException
  */
 public function update($path)
 {
     // if a folder was shared, get a list of all (sub-)folders
     if ($this->view->is_dir($path)) {
         $allFiles = $this->util->getAllFiles($path);
     } else {
         $allFiles = array($path);
     }
     $encryptionModule = $this->encryptionManager->getEncryptionModule();
     foreach ($allFiles as $file) {
         $usersSharing = $this->file->getAccessList($file);
         $encryptionModule->update($file, $this->uid, $usersSharing);
     }
 }
Esempio n. 2
0
 /**
  * update keyfiles and share keys recursively
  *
  * @param int $fileSource file source id
  */
 private function update($fileSource)
 {
     $path = \OC\Files\Filesystem::getPath($fileSource);
     $info = \OC\Files\Filesystem::getFileInfo($path);
     $owner = \OC\Files\Filesystem::getOwner($path);
     $view = new \OC\Files\View('/' . $owner . '/files');
     $ownerPath = $view->getPath($info->getId());
     $absPath = '/' . $owner . '/files' . $ownerPath;
     $mount = $this->mountManager->find($path);
     $mountPoint = $mount->getMountPoint();
     // if a folder was shared, get a list of all (sub-)folders
     if ($this->view->is_dir($absPath)) {
         $allFiles = $this->util->getAllFiles($absPath, $mountPoint);
     } else {
         $allFiles = array($absPath);
     }
     $encryptionModule = $this->encryptionManager->getDefaultEncryptionModule();
     foreach ($allFiles as $path) {
         $usersSharing = $this->file->getAccessList($path);
         $encryptionModule->update($path, $this->uid, $usersSharing);
     }
 }