|
|
|
@ -50,6 +50,7 @@ use OCA\Files_External\Service\UserGlobalStoragesService; |
|
|
|
|
use OCP\IUserManager; |
|
|
|
|
use OCA\Files_External\Service\GlobalStoragesService; |
|
|
|
|
use OCA\Files_External\Service\UserStoragesService; |
|
|
|
|
use OCA\Files_External\Config\UserContext; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Class to configure mount.json globally and for users |
|
|
|
@ -107,7 +108,7 @@ class OC_Mount_Config { |
|
|
|
|
$mountPoint = '/'.$uid.'/files'.$storage->getMountPoint(); |
|
|
|
|
$mountEntry = self::prepareMountPointEntry($storage, false); |
|
|
|
|
foreach ($mountEntry['options'] as &$option) { |
|
|
|
|
$option = self::substitutePlaceholdersInConfig($option); |
|
|
|
|
$option = self::substitutePlaceholdersInConfig($option, $uid); |
|
|
|
|
} |
|
|
|
|
$mountPoints[$mountPoint] = $mountEntry; |
|
|
|
|
} |
|
|
|
@ -116,7 +117,7 @@ class OC_Mount_Config { |
|
|
|
|
$mountPoint = '/'.$uid.'/files'.$storage->getMountPoint(); |
|
|
|
|
$mountEntry = self::prepareMountPointEntry($storage, true); |
|
|
|
|
foreach ($mountEntry['options'] as &$option) { |
|
|
|
|
$option = self::substitutePlaceholdersInConfig($uid, $option); |
|
|
|
|
$option = self::substitutePlaceholdersInConfig($option, $uid); |
|
|
|
|
} |
|
|
|
|
$mountPoints[$mountPoint] = $mountEntry; |
|
|
|
|
} |
|
|
|
@ -215,12 +216,15 @@ class OC_Mount_Config { |
|
|
|
|
* @throws \OCP\AppFramework\QueryException |
|
|
|
|
* @since 16.0.0 |
|
|
|
|
*/ |
|
|
|
|
public static function substitutePlaceholdersInConfig($input) { |
|
|
|
|
public static function substitutePlaceholdersInConfig($input, $user = null) { |
|
|
|
|
/** @var BackendService $backendService */ |
|
|
|
|
$backendService = self::$app->getContainer()->query(BackendService::class); |
|
|
|
|
/** @var IConfigHandler[] $handlers */ |
|
|
|
|
$handlers = $backendService->getConfigHandlers(); |
|
|
|
|
foreach ($handlers as $handler) { |
|
|
|
|
if ($handler instanceof UserContext) { |
|
|
|
|
$handler->setUser($user); |
|
|
|
|
} |
|
|
|
|
$input = $handler->handle($input); |
|
|
|
|
} |
|
|
|
|
return $input; |
|
|
|
|