diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php index c06df7765b63f..de614f4434ede 100644 --- a/apps/files_external/lib/Config/ConfigAdapter.php +++ b/apps/files_external/lib/Config/ConfigAdapter.php @@ -140,6 +140,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) { }, $storages, $storageConfigs); $mounts = array_map(function (StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) { + $storage->setOwner($user->getUID()); if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) { return new PersonalMount( $this->userStoragesService, diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index fe88fb3150f63..87a4a810c0e51 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -861,6 +861,19 @@ public function setAvailability($isAvailable) { $this->getStorageCache()->setAvailability($isAvailable); } + /** + * Allow setting the storage owner + * + * This can be used for storages that do not have a dedicated owner, where we want to + * pass the user that we setup the mountpoint for along to the storage layer + * + * @param string|null $user + * @return void + */ + public function setOwner(?string $user): void { + $this->owner = $user; + } + /** * @return bool */ diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index 2c50bbdb11f6b..4998f9b83692c 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -674,4 +674,8 @@ public function isWrapperOf(IStorage $storage) { } return false; } + + public function setOwner(?string $user): void { + $this->getWrapperStorage()->setOwner($user); + } } diff --git a/lib/public/Files/Storage/IStorage.php b/lib/public/Files/Storage/IStorage.php index 00e98fdfbb6e6..06cd3b70bbb27 100644 --- a/lib/public/Files/Storage/IStorage.php +++ b/lib/public/Files/Storage/IStorage.php @@ -460,4 +460,16 @@ public function getUpdater(); * @since 9.0.0 */ public function getWatcher(); + + /** + * Allow setting the storage owner + * + * This can be used for storages that do not have a dedicated owner, where we want to + * pass the user that we setup the mountpoint for along to the storage layer + * + * @param string|null $user Owner user id + * @return void + * @since 29.0.0 + */ + public function setOwner(?string $user): void; }