Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-08 19:12:26 +0300
committerRobin Appelman <robin@icewind.nl>2022-03-24 19:01:38 +0300
commit469a684d45a3424a4ddd51a023f7b18fec0d950f (patch)
tree95b16e6b2d99ddda24bd77d0c2f6de2907d08ffb /lib/private/Files
parent04052a959443c2df04a11ae1ed523eefd7e0a0ad (diff)
allow getting mounts by provider
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Config/MountProviderCollection.php22
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