feat(files_external): convert to delegated settings

Signed-off-by: Tatjana Kaschperko Lindt <kaschperko-lindt@strato.de>
This commit is contained in:
Tatjana Kaschperko Lindt 2026-03-16 10:57:16 +01:00 committed by Louis
parent 742a2818b7
commit ad39ad91a0
2 changed files with 21 additions and 4 deletions

View file

@ -12,15 +12,16 @@ use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Encryption\IManager;
use OCP\Settings\ISettings;
class Admin implements ISettings {
use OCP\IL10N;
use OCP\Settings\IDelegatedSettings;
class Admin implements IDelegatedSettings {
public function __construct(
private IManager $encryptionManager,
private GlobalStoragesService $globalStoragesService,
private BackendService $backendService,
private GlobalAuth $globalAuth,
private IL10N $l10n,
) {
}
@ -60,4 +61,13 @@ class Admin implements ISettings {
public function getPriority() {
return 40;
}
public function getName(): string {
return $this->l10n->t('External storage');
}
public function getAuthorizedAppConfig(): array {
// No app config keys require delegation for external storage.
return [];
}
}

View file

@ -14,6 +14,7 @@ use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Encryption\IManager;
use OCP\IL10N;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@ -22,6 +23,7 @@ class AdminTest extends TestCase {
private GlobalStoragesService&MockObject $globalStoragesService;
private BackendService&MockObject $backendService;
private GlobalAuth&MockObject $globalAuth;
private IL10N&MockObject $l10n;
private Admin $admin;
protected function setUp(): void {
@ -30,12 +32,17 @@ class AdminTest extends TestCase {
$this->globalStoragesService = $this->createMock(GlobalStoragesService::class);
$this->backendService = $this->createMock(BackendService::class);
$this->globalAuth = $this->createMock(GlobalAuth::class);
$this->l10n = $this->createMock(IL10N::class);
$this->l10n->method('t')->willReturnCallback(function ($text) {
return $text;
});
$this->admin = new Admin(
$this->encryptionManager,
$this->globalStoragesService,
$this->backendService,
$this->globalAuth
$this->globalAuth,
$this->l10n
);
}