Пример #1
0
 /**
  * @brief Delete a single user's shareKey for a single file
  */
 public static function delShareKey(\OC_FilesystemView $view, $userIds, $filePath)
 {
     $proxyStatus = \OC_FileProxy::$enabled;
     \OC_FileProxy::$enabled = false;
     $userId = Helper::getUser($filePath);
     $util = new Util($view, $userId);
     list($owner, $filename) = $util->getUidAndFilename($filePath);
     if ($util->isSystemWideMountPoint($filename)) {
         $shareKeyPath = \OC\Files\Filesystem::normalizePath('/files_encryption/share-keys/' . $filename);
     } else {
         $shareKeyPath = \OC\Files\Filesystem::normalizePath('/' . $owner . '/files_encryption/share-keys/' . $filename);
     }
     if ($view->is_dir($shareKeyPath)) {
         $localPath = \OC\Files\Filesystem::normalizePath($view->getLocalFolder($shareKeyPath));
         self::recursiveDelShareKeys($localPath, $userIds);
     } else {
         foreach ($userIds as $userId) {
             if (!$view->unlink($shareKeyPath . '.' . $userId . '.shareKey')) {
                 \OCP\Util::writeLog('Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath . '.' . $userId . '.shareKey"', \OCP\Util::ERROR);
             }
         }
     }
     \OC_FileProxy::$enabled = $proxyStatus;
 }