From d6f56ea609c41431458c0b565042caf945ab56cc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 29 Jun 2015 19:13:39 +0200 Subject: lock parent folders for the owner when locking a shared file as recipient --- apps/files_sharing/lib/sharedstorage.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'apps/files_sharing/lib/sharedstorage.php') diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 50957663b34..e54f747d3ba 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -45,8 +45,14 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { private $files = array(); private static $isInitialized = array(); + /** + * @var \OC\Files\View + */ + private $ownerView; + public function __construct($arguments) { $this->share = $arguments['share']; + $this->ownerView = $arguments['ownerView']; } /** @@ -623,6 +629,11 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { /** @var \OCP\Files\Storage $targetStorage */ list($targetStorage, $targetInternalPath) = $this->resolvePath($path); $targetStorage->acquireLock($targetInternalPath, $type, $provider); + // lock the parent folders of the owner when locking the share as recipient + if ($path === '') { + $sourcePath = $this->ownerView->getPath($this->share['file_source']); + $this->ownerView->lockFile($sourcePath, ILockingProvider::LOCK_SHARED, true); + } } /** @@ -634,6 +645,11 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { /** @var \OCP\Files\Storage $targetStorage */ list($targetStorage, $targetInternalPath) = $this->resolvePath($path); $targetStorage->releaseLock($targetInternalPath, $type, $provider); + // unlock the parent folders of the owner when unlocking the share as recipient + if ($path === '') { + $sourcePath = $this->ownerView->getPath($this->share['file_source']); + $this->ownerView->unlockFile($sourcePath, ILockingProvider::LOCK_SHARED, true); + } } /** -- cgit v1.2.3