aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Service/UserGlobalStoragesService.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/Service/UserGlobalStoragesService.php')
-rw-r--r--apps/files_external/lib/Service/UserGlobalStoragesService.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php
index c22508e57c4..355401bb84f 100644
--- a/apps/files_external/lib/Service/UserGlobalStoragesService.php
+++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php
@@ -172,4 +172,29 @@ class UserGlobalStoragesService extends GlobalStoragesService {
}
return false;
}
+
+
+ /**
+ * Gets all storages for the user, admin, personal, global, etc
+ *
+ * @return StorageConfig[] array of storage configs
+ */
+ public function getAllStoragesForUser() {
+ if (is_null($this->getUser())) {
+ return [];
+ }
+ $groupIds = $this->groupManager->getUserGroupIds($this->getUser());
+ $mounts = $this->dbConfig->getMountsForUser($this->getUser()->getUID(), $groupIds);
+ $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
+ $configs = array_filter($configs, function ($config) {
+ return $config instanceof StorageConfig;
+ });
+
+ $keys = array_map(function (StorageConfig $config) {
+ return $config->getId();
+ }, $configs);
+
+ $storages = array_combine($keys, $configs);
+ return array_filter($storages, [$this, 'validateStorage']);
+ }
}