diff options
-rw-r--r-- | apps/files_external/lib/Config/ConfigAdapter.php | 1 | ||||
-rw-r--r-- | lib/private/Files/Storage/Common.php | 13 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Wrapper.php | 4 | ||||
-rw-r--r-- | lib/public/Files/Storage/IStorage.php | 12 |
4 files changed, 30 insertions, 0 deletions
diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php index a60ee84820b..12b6a24bcbe 100644 --- a/apps/files_external/lib/Config/ConfigAdapter.php +++ b/apps/files_external/lib/Config/ConfigAdapter.php @@ -140,6 +140,7 @@ class ConfigAdapter implements IMountProvider { }, $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 c236541390f..fb4aa0a7c3c 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -868,6 +868,19 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } /** + * 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 */ public function needsPartFile() { diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index 2e96733ec66..9b7ca0214d1 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -674,4 +674,8 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea } 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 00e98fdfbb6..06cd3b70bbb 100644 --- a/lib/public/Files/Storage/IStorage.php +++ b/lib/public/Files/Storage/IStorage.php @@ -460,4 +460,16 @@ interface IStorage { * @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; } |