diff options
Diffstat (limited to 'apps/files_sharing/lib/MountProvider.php')
-rw-r--r-- | apps/files_sharing/lib/MountProvider.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php index cb02a2b5f23..47a787350d5 100644 --- a/apps/files_sharing/lib/MountProvider.php +++ b/apps/files_sharing/lib/MountProvider.php @@ -27,6 +27,8 @@ namespace OCA\Files_Sharing; +use OC\Cache\CappedMemoryCache; +use OC\Files\View; use OCP\Files\Config\IMountProvider; use OCP\Files\Storage\IStorageFactory; use OCP\IConfig; @@ -84,20 +86,35 @@ class MountProvider implements IMountProvider { $superShares = $this->buildSuperShares($shares, $user); $mounts = []; + $view = new View('/' . $user->getUID() . '/files'); + $ownerViews = []; + $sharingDisabledForUser = $this->shareManager->sharingDisabledForUser($user->getUID()); + $foldersExistCache = new CappedMemoryCache(); foreach ($superShares as $share) { try { - $mounts[] = new SharedMount( + /** @var \OCP\Share\IShare $parentShare */ + $parentShare = $share[0]; + $owner = $parentShare->getShareOwner(); + if (!isset($ownerViews[$owner])) { + $ownerViews[$owner] = new View('/' . $parentShare->getShareOwner() . '/files'); + } + $mount = new SharedMount( '\OCA\Files_Sharing\SharedStorage', $mounts, [ 'user' => $user->getUID(), // parent share - 'superShare' => $share[0], + 'superShare' => $parentShare, // children/component of the superShare 'groupedShares' => $share[1], + 'ownerView' => $ownerViews[$owner], + 'sharingDisabledForUser' => $sharingDisabledForUser ], - $storageFactory + $storageFactory, + $view, + $foldersExistCache ); + $mounts[$mount->getMountPoint()] = $mount; } catch (\Exception $e) { $this->logger->logException($e); $this->logger->error('Error while trying to create shared mount'); @@ -105,7 +122,7 @@ class MountProvider implements IMountProvider { } // array_filter removes the null values from the array - return array_filter($mounts); + return array_values(array_filter($mounts)); } /** |