Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions lib/private/Config/PresetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,22 @@ public function retrieveLexiconPresetApps(): array {
*/
private function getPresetApps(Preset $preset): array {
return match ($preset) {
Preset::CLUB, Preset::FAMILY, Preset::SCHOOL, Preset::UNIVERSITY, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => ['enabled' => ['user_status', 'guests'], 'disabled' => []],
Preset::SHARED => ['enabled' => ['external'], 'disabled' => ['user_status']],
Preset::CLUB, Preset::FAMILY, Preset::SCHOOL, Preset::SMALL, Preset::MEDIUM
=> [
'enabled' => ['user_status','guests','twofactor_backupcodes','twofactor_totp','twofactor_webauthn'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webauthn is not shipped, is that a problem?

'disabled' => []],
Preset::UNIVERSITY, Preset::LARGE
=> [
'enabled' => ['user_status','guests'],
'disabled' => []],
Preset::SHARED
=> [
'enabled' => ['external','twofactor_backupcodes','twofactor_totp','twofactor_webauthn'],
'disabled' => ['user_status']],
Preset::PRIVATE
=> [
'enabled' => ['twofactor_backupcodes','twofactor_totp','twofactor_webauthn'],
'disabled' => []],
default => ['enabled' => [], 'disabled' => []],
};
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/AppConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function setUp(): void {

protected function getAppConfig($cached = false): AppConfig {
$this->config->method('getSystemValueBool')
->with('cache_app_config', $cached)
->with('cache_app_config', true)
->willReturn(true);
$this->cacheFactory->method('isLocalCacheAvailable')->willReturn($cached);
if ($cached) {
Expand Down
28 changes: 0 additions & 28 deletions tests/lib/Config/LexiconTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
use OC\AppConfig;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\Config\ConfigManager;
use OC\Config\PresetManager;
use OCP\App\IAppManager;
use OCP\Config\Exceptions\TypeConflictException;
use OCP\Config\Exceptions\UnknownKeyException;
use OCP\Config\IUserConfig;
use OCP\Config\Lexicon\Preset;
use OCP\Exceptions\AppConfigTypeConflictException;
use OCP\Exceptions\AppConfigUnknownKeyException;
use OCP\IAppConfig;
Expand All @@ -34,7 +32,6 @@ class LexiconTest extends TestCase {
private IAppConfig $appConfig;
private IUserConfig $userConfig;
private ConfigManager $configManager;
private PresetManager $presetManager;
private IAppManager $appManager;

protected function setUp(): void {
Expand All @@ -49,7 +46,6 @@ protected function setUp(): void {
$this->appConfig = Server::get(IAppConfig::class);
$this->userConfig = Server::get(IUserConfig::class);
$this->configManager = Server::get(ConfigManager::class);
$this->presetManager = Server::get(PresetManager::class);
$this->appManager = Server::get(IAppManager::class);
}

Expand Down Expand Up @@ -215,30 +211,6 @@ public function testAppConfigLexiconRenameInvertBoolean() {
$this->assertSame(false, $this->appConfig->getValueBool(TestConfigLexicon_I::APPID, 'key4'));
}

public function testAppConfigLexiconPreset() {
$this->presetManager->setLexiconPreset(Preset::FAMILY);
$this->assertSame('family', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3'));
}

public function testAppConfigLexiconPresets() {
$this->presetManager->setLexiconPreset(Preset::MEDIUM);
$this->assertSame('club+medium', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3'));
$this->presetManager->setLexiconPreset(Preset::FAMILY);
$this->assertSame('family', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3'));
}

public function testUserConfigLexiconPreset() {
$this->presetManager->setLexiconPreset(Preset::FAMILY);
$this->assertSame('family', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3'));
}

public function testUserConfigLexiconPresets() {
$this->presetManager->setLexiconPreset(Preset::MEDIUM);
$this->assertSame('club+medium', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3'));
$this->presetManager->setLexiconPreset(Preset::FAMILY);
$this->assertSame('family', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3'));
}

public function testLexiconIndexedUpdate() {
$this->userConfig->setValueString('user1', TestLexicon_UserIndexed::APPID, 'key1', 'abcd');
$this->userConfig->setValueString('user2', TestLexicon_UserIndexed::APPID, 'key1', '1234', flags: 64);
Expand Down
Loading