diff options
Diffstat (limited to 'apps/files_external/lib/Service/UserGlobalStoragesService.php')
-rw-r--r-- | apps/files_external/lib/Service/UserGlobalStoragesService.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php index 7b9af773233..b8ea137428f 100644 --- a/apps/files_external/lib/Service/UserGlobalStoragesService.php +++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php @@ -27,6 +27,7 @@ namespace OCA\Files_External\Service; use OCA\Files_External\Lib\StorageConfig; use OCP\Files\Config\IUserMountCache; use OCP\IGroupManager; +use OCP\IUser; use OCP\IUserSession; /** @@ -177,14 +178,18 @@ class UserGlobalStoragesService extends GlobalStoragesService { /** * Gets all storages for the user, admin, personal, global, etc * + * @param IUser|null $user user to get the storages for, if not set the currently logged in user will be used * @return StorageConfig[] array of storage configs */ - public function getAllStoragesForUser() { - if (is_null($this->getUser())) { + public function getAllStoragesForUser(IUser $user = null) { + if (is_null($user)) { + $user = $this->getUser(); + } + if (is_null($user)) { return []; } - $groupIds = $this->groupManager->getUserGroupIds($this->getUser()); - $mounts = $this->dbConfig->getMountsForUser($this->getUser()->getUID(), $groupIds); + $groupIds = $this->groupManager->getUserGroupIds($user); + $mounts = $this->dbConfig->getMountsForUser($user->getUID(), $groupIds); $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts); $configs = array_filter($configs, function ($config) { return $config instanceof StorageConfig; |