From 301289c3f0d1bd83b2b802e295b12da8d7ffb8e5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 4 Aug 2025 13:36:39 +0200 Subject: [PATCH] fix: remove constructor overwrite from AppConfigOverwrite Signed-off-by: Robin Appelman --- lib/AppConfigOverwrite.php | 17 ++++------------- lib/RestrictionManager.php | 23 ++++++++++------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/lib/AppConfigOverwrite.php b/lib/AppConfigOverwrite.php index 2f84a141..2a2df3f3 100644 --- a/lib/AppConfigOverwrite.php +++ b/lib/AppConfigOverwrite.php @@ -9,23 +9,14 @@ namespace OCA\Guests; use OC\AppConfig; -use OCP\IDBConnection; -use OCP\Security\ICrypto; -use Psr\Log\LoggerInterface; class AppConfigOverwrite extends AppConfig { /** @var string[][] */ - private $overWrite; - - public function __construct( - IDBConnection $connection, - LoggerInterface $logger, - ICrypto $crypto, - array $overWrite, - ) { - parent::__construct($connection, $logger, $crypto); - $this->overWrite = $overWrite; + private $overWrite = []; + + public function setOverwrite(array $overwrite): void { + $this->overWrite = $overwrite; } /** diff --git a/lib/RestrictionManager.php b/lib/RestrictionManager.php index 89f69d48..f161d0d7 100644 --- a/lib/RestrictionManager.php +++ b/lib/RestrictionManager.php @@ -12,13 +12,11 @@ use OCA\Files_External\Config\ExternalMountPoint; use OCP\Files\Config\IMountProviderCollection; use OCP\Files\Mount\IMountPoint; -use OCP\IDBConnection; use OCP\INavigationManager; use OCP\IRequest; use OCP\IServerContainer; use OCP\IUser; use OCP\IUserSession; -use OCP\Security\ICrypto; use OCP\Settings\IManager; use Psr\Log\LoggerInterface; @@ -80,17 +78,16 @@ public function lateSetupRestrictions(): void { $this->userBackend->setAllowListing(false); - $this->server->registerService(AppConfig::class, function () { - return new AppConfigOverwrite( - $this->server->get(IDBConnection::class), - $this->server->get(LoggerInterface::class), - $this->server->get(ICrypto::class), - [ - 'core' => [ - 'shareapi_only_share_with_group_members' => 'yes' - ] - ] - ); + /** @var AppConfigOverwrite $appConfig */ + $appConfig = $this->server->get(AppConfigOverwrite::class); + $appConfig->setOverwrite([ + 'core' => [ + 'shareapi_only_share_with_group_members' => 'yes' + ] + ]); + + $this->server->registerService(AppConfig::class, function () use ($appConfig) { + return $appConfig; }); } }