mirror of https://github.com/nextcloud/server
Merge pull request #44294 from nextcloud/fix/storage-mount-owner
fix: Pass the mountpoint target user to storages without owner
This commit is contained in:
commit
e0fcf6b700
|
@ -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,
|
||||
|
|
|
@ -867,6 +867,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
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue