diff options
Diffstat (limited to 'lib/private/Files/Config/MountProviderCollection.php')
-rw-r--r-- | lib/private/Files/Config/MountProviderCollection.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index cd8a2a2e29f..efbb54edba5 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -75,16 +75,15 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { } /** - * Get all configured mount points for the user - * - * @param \OCP\IUser $user - * @return \OCP\Files\Mount\IMountPoint[] + * @param IUser $user + * @param IMountProvider[] $providers + * @return IMountPoint[] */ - public function getMountsForUser(IUser $user) { + private function getMountsForFromProviders(IUser $user, array $providers): array { $loader = $this->loader; $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { return $provider->getMountsForUser($user, $loader); - }, $this->providers); + }, $providers); $mounts = array_filter($mounts, function ($result) { return is_array($result); }); @@ -94,6 +93,17 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { return $this->filterMounts($user, $mounts); } + public function getMountsForUser(IUser $user): array { + return $this->getMountsForFromProviders($user, $this->providers); + } + + public function getMountsFromProvider(IUser $user, string $mountProviderClass): array { + $providers = array_filter($this->providers, function (IMountProvider $mountProvider) use ($mountProviderClass) { + return get_class($mountProvider) === $mountProviderClass; + }); + return $this->getMountsForFromProviders($user, $providers); + } + public function addMountForUser(IUser $user, IMountManager $mountManager) { // shared mount provider gets to go last since it needs to know existing files // to check for name collisions |