Merge pull request #46680 from nextcloud/backport/44294/stable28

[stable28] fix: Pass the mountpoint target user to storages without owner
This commit is contained in:
Andy Scherzinger 2024-09-03 17:46:40 +02:00 committed by GitHub
commit 208bbf307c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 0 deletions

View file

@ -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,

View file

@ -861,6 +861,19 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
$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
*/

View file

@ -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);
}
}

View file

@ -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 28.0.10
*/
public function setOwner(?string $user): void;
}