示例#1
0
 /**
  * store multiple share keys for a single file
  * @param \OC\Files\View $view
  * @param \OCA\Files_Encryption\Util $util
  * @param string $path
  * @param array $shareKeys
  * @return bool
  */
 public static function setShareKeys($view, $util, $path, array $shareKeys)
 {
     // in case of system wide mount points the keys are stored directly in the data directory
     $basePath = Keymanager::getKeyPath($view, $util, $path);
     self::keySetPreparation($view, $basePath);
     $result = true;
     foreach ($shareKeys as $userId => $shareKey) {
         if (!self::setKey($basePath, $userId . '.shareKey', $shareKey, $view)) {
             // If any of the keys are not set, flag false
             $result = false;
         }
     }
     // Returns false if any of the keys weren't set
     return $result;
 }
示例#2
0
 /**
  * unmount file from yourself
  * remember files/folders which get unmounted
  */
 public static function preUnmount($params)
 {
     $view = new \OC\Files\View('/');
     $user = \OCP\User::getUser();
     $path = $params[\OC\Files\Filesystem::signal_param_path];
     $util = new Util($view, $user);
     list($owner, $ownerPath) = $util->getUidAndFilename($path);
     $keysPath = Keymanager::getKeyPath($view, $util, $path);
     self::$unmountedFiles[$path] = array('keyPath' => $keysPath, 'owner' => $owner, 'ownerPath' => $ownerPath);
 }