@@ -25,217 +25,217 @@ |
||
25 | 25 | * tools to manage the Preset feature |
26 | 26 | */ |
27 | 27 | class PresetManager { |
28 | - private const PRESET_CONFIGKEY = 'config_preset'; |
|
29 | - |
|
30 | - private ?AppManager $appManager = null; |
|
31 | - private ?Installer $installer = null; |
|
32 | - |
|
33 | - private ?Preset $configLexiconPreset = null; |
|
34 | - |
|
35 | - public function __construct( |
|
36 | - private readonly IConfig $config, |
|
37 | - private readonly ConfigManager $configManager, |
|
38 | - private readonly LoggerInterface $logger, |
|
39 | - ) { |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * store in config.php the new preset |
|
44 | - * refresh cached preset |
|
45 | - */ |
|
46 | - public function setLexiconPreset(Preset $preset): void { |
|
47 | - $this->config->setSystemValue(self::PRESET_CONFIGKEY, $preset->value); |
|
48 | - $this->configLexiconPreset = $preset; |
|
49 | - $this->configManager->clearConfigCaches(); |
|
50 | - $this->refreshPresetApps(); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * returns currently selected Preset |
|
55 | - */ |
|
56 | - public function getLexiconPreset(): Preset { |
|
57 | - if ($this->configLexiconPreset === null) { |
|
58 | - $this->configLexiconPreset = Preset::tryFrom($this->config->getSystemValueInt(self::PRESET_CONFIGKEY, 0)) ?? Preset::NONE; |
|
59 | - } |
|
60 | - |
|
61 | - return $this->configLexiconPreset; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * get lexicon config entries affected by Preset and its default values |
|
66 | - * |
|
67 | - * **Warning** This method MUST be considered resource-needy! |
|
68 | - * |
|
69 | - * @return array<string, list<array{config: string, defaults: array{CLUB: null|string, FAMILY: null|string, LARGE: null|string, MEDIUM: null|string, NONE: null|string, PRIVATE: null|string, SCHOOL: null|string, SHARED: null|string, SMALL: null|string, UNIVERSITY: null|string}, entry: array{definition: string, deprecated: bool, key: string, lazy: bool, note: string, type: 'ARRAY'|'BOOL'|'FLOAT'|'INT'|'MIXED'|'STRING'}, value?: mixed}>> |
|
70 | - */ |
|
71 | - public function retrieveLexiconPreset(?string $appId = null): array { |
|
72 | - if ($appId === null) { |
|
73 | - $apps = []; |
|
74 | - foreach (['core'] + Server::get(IAppManager::class)->getEnabledApps() as $app) { |
|
75 | - $preset = $this->retrieveLexiconPreset($app); |
|
76 | - $apps[$app] = $preset[$app]; |
|
77 | - } |
|
78 | - return $apps; |
|
79 | - } |
|
80 | - |
|
81 | - return [ |
|
82 | - $appId => array_merge( |
|
83 | - $this->extractLexiconPresetFromConfigClass($appId, 'app', Server::get(IAppConfig::class)), |
|
84 | - $this->extractLexiconPresetFromConfigClass($appId, 'user', Server::get(IUserConfig::class)) |
|
85 | - ), |
|
86 | - ]; |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @param string $appId |
|
91 | - * |
|
92 | - * @return list<array{config: string, defaults: array{CLUB: null|string, FAMILY: null|string, LARGE: null|string, MEDIUM: null|string, NONE: null|string, PRIVATE: null|string, SCHOOL: null|string, SHARED: null|string, SMALL: null|string, UNIVERSITY: null|string}, entry: array{definition: string, deprecated: bool, key: string, lazy: bool, note: string, type: 'ARRAY'|'BOOL'|'FLOAT'|'INT'|'MIXED'|'STRING'}, value?: mixed}> |
|
93 | - */ |
|
94 | - private function extractLexiconPresetFromConfigClass( |
|
95 | - string $appId, |
|
96 | - string $configType, |
|
97 | - AppConfig|UserConfig $config, |
|
98 | - ): array { |
|
99 | - $presets = []; |
|
100 | - $lexicon = $config->getConfigDetailsFromLexicon($appId); |
|
101 | - foreach ($lexicon['entries'] as $entry) { |
|
102 | - $defaults = []; |
|
103 | - foreach (Preset::cases() as $case) { |
|
104 | - // for each case, we need to use a fresh IAppConfig with clear cache |
|
105 | - // cloning to avoid conflict while emulating preset |
|
106 | - $newConfig = clone $config; |
|
107 | - if ($newConfig instanceof AppConfig) { |
|
108 | - // needed to ignore cache and rebuild default |
|
109 | - $newConfig->clearCache(); |
|
110 | - } |
|
111 | - if ($newConfig instanceof UserConfig) { |
|
112 | - // in the case of IUserConfig, clear all users' cache |
|
113 | - $newConfig->clearCacheAll(); |
|
114 | - } |
|
115 | - |
|
116 | - $newLexicon = $newConfig->getLexiconEntry($appId, $entry->getKey()); |
|
117 | - $defaults[$case->name] = $newLexicon?->getDefault($case); |
|
118 | - } |
|
119 | - |
|
120 | - // compare all value from $defaults, if more than 1 exist we have a preset |
|
121 | - $uniqueness = array_unique($defaults); |
|
122 | - if (count($uniqueness) < 2) { |
|
123 | - continue; |
|
124 | - } |
|
125 | - |
|
126 | - $details = [ |
|
127 | - 'config' => $configType, |
|
128 | - 'entry' => [ |
|
129 | - 'key' => $entry->getKey(), |
|
130 | - 'type' => $entry->getValueType()->name, |
|
131 | - 'definition' => $entry->getDefinition(), |
|
132 | - 'lazy' => $entry->isLazy(), |
|
133 | - 'deprecated' => $entry->isDeprecated(), |
|
134 | - 'note' => $entry->getNote(), |
|
135 | - ], |
|
136 | - 'defaults' => $defaults |
|
137 | - ]; |
|
138 | - |
|
139 | - try { |
|
140 | - // not interested if a users config value is already set |
|
141 | - if ($config instanceof AppConfig) { |
|
142 | - $details['value'] = $config->getDetails($appId, $entry->getKey())['value']; |
|
143 | - } |
|
144 | - } catch (AppConfigUnknownKeyException) { |
|
145 | - } |
|
146 | - |
|
147 | - $presets[] = $details; |
|
148 | - } |
|
149 | - |
|
150 | - return $presets; |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Enable and/or Disable a list of apps based on the currently selected Preset |
|
155 | - */ |
|
156 | - public function refreshPresetApps(): void { |
|
157 | - $this->loadAppManager(); |
|
158 | - |
|
159 | - $apps = $this->getPresetApps($this->getLexiconPreset()); |
|
160 | - foreach ($apps['disabled'] ?? [] as $app) { |
|
161 | - try { |
|
162 | - $this->appManager->disableApp($app); |
|
163 | - } catch (\Exception $e) { |
|
164 | - $this->logger->warning('could not disable app', ['exception' => $e]); |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - foreach ($apps['enabled'] ?? [] as $app) { |
|
169 | - $this->installApp($app); |
|
170 | - } |
|
171 | - } |
|
172 | - |
|
173 | - /** |
|
174 | - * some parts cannot be initiated at __construct() time |
|
175 | - */ |
|
176 | - private function loadAppManager(): void { |
|
177 | - if ($this->appManager === null) { |
|
178 | - $this->appManager = Server::get(IAppManager::class); |
|
179 | - } |
|
180 | - if ($this->installer === null) { |
|
181 | - $this->installer = Server::get(Installer::class); |
|
182 | - } |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * download, install and enable app. |
|
187 | - * generate warning entry in logs in case of failure. |
|
188 | - */ |
|
189 | - private function installApp(string $appId): void { |
|
190 | - $this->loadAppManager(); |
|
191 | - if (!$this->installer->isDownloaded($appId)) { |
|
192 | - try { |
|
193 | - $this->installer->downloadApp($appId); |
|
194 | - } catch (\Exception $e) { |
|
195 | - $this->logger->warning('could not download app', ['appId' => $appId, 'exception' => $e]); |
|
196 | - return; |
|
197 | - } |
|
198 | - } |
|
199 | - |
|
200 | - try { |
|
201 | - $this->installer->installApp($appId, true); |
|
202 | - } catch (\Exception $e) { |
|
203 | - $this->logger->warning('could not install app', ['appId' => $appId, 'exception' => $e]); |
|
204 | - return; |
|
205 | - } |
|
206 | - |
|
207 | - try { |
|
208 | - $this->appManager->enableApp($appId); |
|
209 | - } catch (AppPathNotFoundException $e) { |
|
210 | - $this->logger->warning('could not enable app', ['appId' => $appId, 'exception' => $e]); |
|
211 | - return; |
|
212 | - } |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * return list of apps that are enabled/disabled when switching current Preset |
|
217 | - * |
|
218 | - * @return array<string, array{disabled: list<string>, enabled: list<string>}> |
|
219 | - */ |
|
220 | - public function retrieveLexiconPresetApps(): array { |
|
221 | - $apps = []; |
|
222 | - foreach (Preset::cases() as $case) { |
|
223 | - $apps[$case->name] = $this->getPresetApps($case); |
|
224 | - } |
|
225 | - |
|
226 | - return $apps; |
|
227 | - } |
|
228 | - |
|
229 | - /** |
|
230 | - * get listing of enabled/disabled app from Preset |
|
231 | - * |
|
232 | - * @return array{enabled: list<string>, disabled: list<string>} |
|
233 | - */ |
|
234 | - private function getPresetApps(Preset $preset): array { |
|
235 | - return match ($preset) { |
|
236 | - Preset::CLUB, Preset::FAMILY, Preset::SCHOOL, Preset::UNIVERSITY, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => ['enabled' => ['user_status', 'intros', 'guests'], 'disabled' => []], |
|
237 | - Preset::SHARED => ['enabled' => ['intros', 'external'], 'disabled' => ['user_status']], |
|
238 | - default => ['enabled' => [], 'disabled' => []], |
|
239 | - }; |
|
240 | - } |
|
28 | + private const PRESET_CONFIGKEY = 'config_preset'; |
|
29 | + |
|
30 | + private ?AppManager $appManager = null; |
|
31 | + private ?Installer $installer = null; |
|
32 | + |
|
33 | + private ?Preset $configLexiconPreset = null; |
|
34 | + |
|
35 | + public function __construct( |
|
36 | + private readonly IConfig $config, |
|
37 | + private readonly ConfigManager $configManager, |
|
38 | + private readonly LoggerInterface $logger, |
|
39 | + ) { |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * store in config.php the new preset |
|
44 | + * refresh cached preset |
|
45 | + */ |
|
46 | + public function setLexiconPreset(Preset $preset): void { |
|
47 | + $this->config->setSystemValue(self::PRESET_CONFIGKEY, $preset->value); |
|
48 | + $this->configLexiconPreset = $preset; |
|
49 | + $this->configManager->clearConfigCaches(); |
|
50 | + $this->refreshPresetApps(); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * returns currently selected Preset |
|
55 | + */ |
|
56 | + public function getLexiconPreset(): Preset { |
|
57 | + if ($this->configLexiconPreset === null) { |
|
58 | + $this->configLexiconPreset = Preset::tryFrom($this->config->getSystemValueInt(self::PRESET_CONFIGKEY, 0)) ?? Preset::NONE; |
|
59 | + } |
|
60 | + |
|
61 | + return $this->configLexiconPreset; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * get lexicon config entries affected by Preset and its default values |
|
66 | + * |
|
67 | + * **Warning** This method MUST be considered resource-needy! |
|
68 | + * |
|
69 | + * @return array<string, list<array{config: string, defaults: array{CLUB: null|string, FAMILY: null|string, LARGE: null|string, MEDIUM: null|string, NONE: null|string, PRIVATE: null|string, SCHOOL: null|string, SHARED: null|string, SMALL: null|string, UNIVERSITY: null|string}, entry: array{definition: string, deprecated: bool, key: string, lazy: bool, note: string, type: 'ARRAY'|'BOOL'|'FLOAT'|'INT'|'MIXED'|'STRING'}, value?: mixed}>> |
|
70 | + */ |
|
71 | + public function retrieveLexiconPreset(?string $appId = null): array { |
|
72 | + if ($appId === null) { |
|
73 | + $apps = []; |
|
74 | + foreach (['core'] + Server::get(IAppManager::class)->getEnabledApps() as $app) { |
|
75 | + $preset = $this->retrieveLexiconPreset($app); |
|
76 | + $apps[$app] = $preset[$app]; |
|
77 | + } |
|
78 | + return $apps; |
|
79 | + } |
|
80 | + |
|
81 | + return [ |
|
82 | + $appId => array_merge( |
|
83 | + $this->extractLexiconPresetFromConfigClass($appId, 'app', Server::get(IAppConfig::class)), |
|
84 | + $this->extractLexiconPresetFromConfigClass($appId, 'user', Server::get(IUserConfig::class)) |
|
85 | + ), |
|
86 | + ]; |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @param string $appId |
|
91 | + * |
|
92 | + * @return list<array{config: string, defaults: array{CLUB: null|string, FAMILY: null|string, LARGE: null|string, MEDIUM: null|string, NONE: null|string, PRIVATE: null|string, SCHOOL: null|string, SHARED: null|string, SMALL: null|string, UNIVERSITY: null|string}, entry: array{definition: string, deprecated: bool, key: string, lazy: bool, note: string, type: 'ARRAY'|'BOOL'|'FLOAT'|'INT'|'MIXED'|'STRING'}, value?: mixed}> |
|
93 | + */ |
|
94 | + private function extractLexiconPresetFromConfigClass( |
|
95 | + string $appId, |
|
96 | + string $configType, |
|
97 | + AppConfig|UserConfig $config, |
|
98 | + ): array { |
|
99 | + $presets = []; |
|
100 | + $lexicon = $config->getConfigDetailsFromLexicon($appId); |
|
101 | + foreach ($lexicon['entries'] as $entry) { |
|
102 | + $defaults = []; |
|
103 | + foreach (Preset::cases() as $case) { |
|
104 | + // for each case, we need to use a fresh IAppConfig with clear cache |
|
105 | + // cloning to avoid conflict while emulating preset |
|
106 | + $newConfig = clone $config; |
|
107 | + if ($newConfig instanceof AppConfig) { |
|
108 | + // needed to ignore cache and rebuild default |
|
109 | + $newConfig->clearCache(); |
|
110 | + } |
|
111 | + if ($newConfig instanceof UserConfig) { |
|
112 | + // in the case of IUserConfig, clear all users' cache |
|
113 | + $newConfig->clearCacheAll(); |
|
114 | + } |
|
115 | + |
|
116 | + $newLexicon = $newConfig->getLexiconEntry($appId, $entry->getKey()); |
|
117 | + $defaults[$case->name] = $newLexicon?->getDefault($case); |
|
118 | + } |
|
119 | + |
|
120 | + // compare all value from $defaults, if more than 1 exist we have a preset |
|
121 | + $uniqueness = array_unique($defaults); |
|
122 | + if (count($uniqueness) < 2) { |
|
123 | + continue; |
|
124 | + } |
|
125 | + |
|
126 | + $details = [ |
|
127 | + 'config' => $configType, |
|
128 | + 'entry' => [ |
|
129 | + 'key' => $entry->getKey(), |
|
130 | + 'type' => $entry->getValueType()->name, |
|
131 | + 'definition' => $entry->getDefinition(), |
|
132 | + 'lazy' => $entry->isLazy(), |
|
133 | + 'deprecated' => $entry->isDeprecated(), |
|
134 | + 'note' => $entry->getNote(), |
|
135 | + ], |
|
136 | + 'defaults' => $defaults |
|
137 | + ]; |
|
138 | + |
|
139 | + try { |
|
140 | + // not interested if a users config value is already set |
|
141 | + if ($config instanceof AppConfig) { |
|
142 | + $details['value'] = $config->getDetails($appId, $entry->getKey())['value']; |
|
143 | + } |
|
144 | + } catch (AppConfigUnknownKeyException) { |
|
145 | + } |
|
146 | + |
|
147 | + $presets[] = $details; |
|
148 | + } |
|
149 | + |
|
150 | + return $presets; |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Enable and/or Disable a list of apps based on the currently selected Preset |
|
155 | + */ |
|
156 | + public function refreshPresetApps(): void { |
|
157 | + $this->loadAppManager(); |
|
158 | + |
|
159 | + $apps = $this->getPresetApps($this->getLexiconPreset()); |
|
160 | + foreach ($apps['disabled'] ?? [] as $app) { |
|
161 | + try { |
|
162 | + $this->appManager->disableApp($app); |
|
163 | + } catch (\Exception $e) { |
|
164 | + $this->logger->warning('could not disable app', ['exception' => $e]); |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + foreach ($apps['enabled'] ?? [] as $app) { |
|
169 | + $this->installApp($app); |
|
170 | + } |
|
171 | + } |
|
172 | + |
|
173 | + /** |
|
174 | + * some parts cannot be initiated at __construct() time |
|
175 | + */ |
|
176 | + private function loadAppManager(): void { |
|
177 | + if ($this->appManager === null) { |
|
178 | + $this->appManager = Server::get(IAppManager::class); |
|
179 | + } |
|
180 | + if ($this->installer === null) { |
|
181 | + $this->installer = Server::get(Installer::class); |
|
182 | + } |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * download, install and enable app. |
|
187 | + * generate warning entry in logs in case of failure. |
|
188 | + */ |
|
189 | + private function installApp(string $appId): void { |
|
190 | + $this->loadAppManager(); |
|
191 | + if (!$this->installer->isDownloaded($appId)) { |
|
192 | + try { |
|
193 | + $this->installer->downloadApp($appId); |
|
194 | + } catch (\Exception $e) { |
|
195 | + $this->logger->warning('could not download app', ['appId' => $appId, 'exception' => $e]); |
|
196 | + return; |
|
197 | + } |
|
198 | + } |
|
199 | + |
|
200 | + try { |
|
201 | + $this->installer->installApp($appId, true); |
|
202 | + } catch (\Exception $e) { |
|
203 | + $this->logger->warning('could not install app', ['appId' => $appId, 'exception' => $e]); |
|
204 | + return; |
|
205 | + } |
|
206 | + |
|
207 | + try { |
|
208 | + $this->appManager->enableApp($appId); |
|
209 | + } catch (AppPathNotFoundException $e) { |
|
210 | + $this->logger->warning('could not enable app', ['appId' => $appId, 'exception' => $e]); |
|
211 | + return; |
|
212 | + } |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * return list of apps that are enabled/disabled when switching current Preset |
|
217 | + * |
|
218 | + * @return array<string, array{disabled: list<string>, enabled: list<string>}> |
|
219 | + */ |
|
220 | + public function retrieveLexiconPresetApps(): array { |
|
221 | + $apps = []; |
|
222 | + foreach (Preset::cases() as $case) { |
|
223 | + $apps[$case->name] = $this->getPresetApps($case); |
|
224 | + } |
|
225 | + |
|
226 | + return $apps; |
|
227 | + } |
|
228 | + |
|
229 | + /** |
|
230 | + * get listing of enabled/disabled app from Preset |
|
231 | + * |
|
232 | + * @return array{enabled: list<string>, disabled: list<string>} |
|
233 | + */ |
|
234 | + private function getPresetApps(Preset $preset): array { |
|
235 | + return match ($preset) { |
|
236 | + Preset::CLUB, Preset::FAMILY, Preset::SCHOOL, Preset::UNIVERSITY, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => ['enabled' => ['user_status', 'intros', 'guests'], 'disabled' => []], |
|
237 | + Preset::SHARED => ['enabled' => ['intros', 'external'], 'disabled' => ['user_status']], |
|
238 | + default => ['enabled' => [], 'disabled' => []], |
|
239 | + }; |
|
240 | + } |
|
241 | 241 | } |
@@ -18,78 +18,78 @@ |
||
18 | 18 | use Symfony\Component\Console\Output\OutputInterface; |
19 | 19 | |
20 | 20 | class Preset extends Base { |
21 | - public function __construct( |
|
22 | - private readonly PresetManager $presetManager, |
|
23 | - ) { |
|
24 | - parent::__construct(); |
|
25 | - } |
|
21 | + public function __construct( |
|
22 | + private readonly PresetManager $presetManager, |
|
23 | + ) { |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | - protected function configure() { |
|
28 | - parent::configure(); |
|
29 | - $this->setName('config:preset') |
|
30 | - ->setDescription('Select a config preset') |
|
31 | - ->addArgument('preset', InputArgument::OPTIONAL, 'Preset to use for all unset config values', '') |
|
32 | - ->addOption('list', '', InputOption::VALUE_NONE, 'display available preset') |
|
33 | - ->addOption('apps', '', InputOption::VALUE_NONE, 'return list of enabled/disabled apps when switching preset') |
|
34 | - ->addOption('compare', '', InputOption::VALUE_NONE, 'compare preset'); |
|
35 | - } |
|
27 | + protected function configure() { |
|
28 | + parent::configure(); |
|
29 | + $this->setName('config:preset') |
|
30 | + ->setDescription('Select a config preset') |
|
31 | + ->addArgument('preset', InputArgument::OPTIONAL, 'Preset to use for all unset config values', '') |
|
32 | + ->addOption('list', '', InputOption::VALUE_NONE, 'display available preset') |
|
33 | + ->addOption('apps', '', InputOption::VALUE_NONE, 'return list of enabled/disabled apps when switching preset') |
|
34 | + ->addOption('compare', '', InputOption::VALUE_NONE, 'compare preset'); |
|
35 | + } |
|
36 | 36 | |
37 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
38 | - if ($input->getOption('list')) { |
|
39 | - $this->getEnum('', $list); |
|
40 | - $this->writeArrayInOutputFormat($input, $output, $list); |
|
41 | - return self::SUCCESS; |
|
42 | - } |
|
37 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
38 | + if ($input->getOption('list')) { |
|
39 | + $this->getEnum('', $list); |
|
40 | + $this->writeArrayInOutputFormat($input, $output, $list); |
|
41 | + return self::SUCCESS; |
|
42 | + } |
|
43 | 43 | |
44 | - if ($input->getOption('apps')) { |
|
45 | - $this->writeArrayInOutputFormat($input, $output, $this->presetManager->retrieveLexiconPresetApps()); |
|
46 | - return self::SUCCESS; |
|
47 | - } |
|
44 | + if ($input->getOption('apps')) { |
|
45 | + $this->writeArrayInOutputFormat($input, $output, $this->presetManager->retrieveLexiconPresetApps()); |
|
46 | + return self::SUCCESS; |
|
47 | + } |
|
48 | 48 | |
49 | - if ($input->getOption('compare')) { |
|
50 | - $list = $this->presetManager->retrieveLexiconPreset(); |
|
51 | - if ($input->getOption('output') === 'plain') { |
|
52 | - $table = new Table($output); |
|
53 | - $table->setHeaders(['app', 'config', 'config key', 'value', ...array_map(static fn (ConfigLexiconPreset $p): string => $p->name, ConfigLexiconPreset::cases())]); |
|
54 | - foreach ($list as $appId => $entries) { |
|
55 | - foreach ($entries as $item) { |
|
56 | - $table->addRow([$appId, $item['config'], $item['entry']['key'], '<comment>' . ($item['value'] ?? '') . '</comment>', ...($item['defaults'] ?? [])]); |
|
57 | - } |
|
58 | - } |
|
59 | - $table->render(); |
|
60 | - return self::SUCCESS; |
|
61 | - } |
|
49 | + if ($input->getOption('compare')) { |
|
50 | + $list = $this->presetManager->retrieveLexiconPreset(); |
|
51 | + if ($input->getOption('output') === 'plain') { |
|
52 | + $table = new Table($output); |
|
53 | + $table->setHeaders(['app', 'config', 'config key', 'value', ...array_map(static fn (ConfigLexiconPreset $p): string => $p->name, ConfigLexiconPreset::cases())]); |
|
54 | + foreach ($list as $appId => $entries) { |
|
55 | + foreach ($entries as $item) { |
|
56 | + $table->addRow([$appId, $item['config'], $item['entry']['key'], '<comment>' . ($item['value'] ?? '') . '</comment>', ...($item['defaults'] ?? [])]); |
|
57 | + } |
|
58 | + } |
|
59 | + $table->render(); |
|
60 | + return self::SUCCESS; |
|
61 | + } |
|
62 | 62 | |
63 | - $this->writeArrayInOutputFormat($input, $output, $list); |
|
64 | - return self::SUCCESS; |
|
65 | - } |
|
63 | + $this->writeArrayInOutputFormat($input, $output, $list); |
|
64 | + return self::SUCCESS; |
|
65 | + } |
|
66 | 66 | |
67 | - $presetArg = $input->getArgument('preset'); |
|
68 | - if ($presetArg !== '') { |
|
69 | - $preset = $this->getEnum($presetArg, $list); |
|
70 | - if ($preset === null) { |
|
71 | - $output->writeln('<error>Invalid preset: ' . $presetArg . '</error>'); |
|
72 | - $output->writeln('Available presets: ' . implode(', ', $list)); |
|
73 | - return self::INVALID; |
|
74 | - } |
|
67 | + $presetArg = $input->getArgument('preset'); |
|
68 | + if ($presetArg !== '') { |
|
69 | + $preset = $this->getEnum($presetArg, $list); |
|
70 | + if ($preset === null) { |
|
71 | + $output->writeln('<error>Invalid preset: ' . $presetArg . '</error>'); |
|
72 | + $output->writeln('Available presets: ' . implode(', ', $list)); |
|
73 | + return self::INVALID; |
|
74 | + } |
|
75 | 75 | |
76 | - $this->presetManager->setLexiconPreset($preset); |
|
77 | - } |
|
76 | + $this->presetManager->setLexiconPreset($preset); |
|
77 | + } |
|
78 | 78 | |
79 | - $current = $this->presetManager->getLexiconPreset(); |
|
80 | - $this->writeArrayInOutputFormat($input, $output, [$current->name], 'current preset: '); |
|
81 | - return self::SUCCESS; |
|
82 | - } |
|
79 | + $current = $this->presetManager->getLexiconPreset(); |
|
80 | + $this->writeArrayInOutputFormat($input, $output, [$current->name], 'current preset: '); |
|
81 | + return self::SUCCESS; |
|
82 | + } |
|
83 | 83 | |
84 | - private function getEnum(string $name, ?array &$list = null): ?ConfigLexiconPreset { |
|
85 | - $list = []; |
|
86 | - foreach (ConfigLexiconPreset::cases() as $case) { |
|
87 | - $list[] = $case->name; |
|
88 | - if (strtolower($case->name) === strtolower($name)) { |
|
89 | - return $case; |
|
90 | - } |
|
91 | - } |
|
84 | + private function getEnum(string $name, ?array &$list = null): ?ConfigLexiconPreset { |
|
85 | + $list = []; |
|
86 | + foreach (ConfigLexiconPreset::cases() as $case) { |
|
87 | + $list[] = $case->name; |
|
88 | + if (strtolower($case->name) === strtolower($name)) { |
|
89 | + return $case; |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | - return null; |
|
94 | - } |
|
93 | + return null; |
|
94 | + } |
|
95 | 95 | } |
@@ -20,34 +20,34 @@ |
||
20 | 20 | #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] |
21 | 21 | class PresetController extends Controller { |
22 | 22 | |
23 | - public function __construct( |
|
24 | - string $appName, |
|
25 | - IRequest $request, |
|
26 | - private readonly PresetManager $presetManager, |
|
27 | - ) { |
|
28 | - parent::__construct($appName, $request); |
|
29 | - } |
|
30 | - |
|
31 | - public function getCurrentPreset(): DataResponse { |
|
32 | - return new DataResponse($this->presetManager->getLexiconPreset()->name); |
|
33 | - } |
|
34 | - |
|
35 | - public function setCurrentPreset(string $presetName): DataResponse { |
|
36 | - foreach (Preset::cases() as $case) { |
|
37 | - if ($case->name === $presetName) { |
|
38 | - $this->presetManager->setLexiconPreset($case); |
|
39 | - return $this->getCurrentPreset(); |
|
40 | - } |
|
41 | - } |
|
42 | - throw new OCSBadRequestException('Invalid preset name provided'); |
|
43 | - } |
|
44 | - |
|
45 | - public function getPreset(): DataResponse { |
|
46 | - return new DataResponse( |
|
47 | - [ |
|
48 | - 'preset' => $this->presetManager->retrieveLexiconPreset(), |
|
49 | - 'apps' => $this->presetManager->retrieveLexiconPresetApps() |
|
50 | - ] |
|
51 | - ); |
|
52 | - } |
|
23 | + public function __construct( |
|
24 | + string $appName, |
|
25 | + IRequest $request, |
|
26 | + private readonly PresetManager $presetManager, |
|
27 | + ) { |
|
28 | + parent::__construct($appName, $request); |
|
29 | + } |
|
30 | + |
|
31 | + public function getCurrentPreset(): DataResponse { |
|
32 | + return new DataResponse($this->presetManager->getLexiconPreset()->name); |
|
33 | + } |
|
34 | + |
|
35 | + public function setCurrentPreset(string $presetName): DataResponse { |
|
36 | + foreach (Preset::cases() as $case) { |
|
37 | + if ($case->name === $presetName) { |
|
38 | + $this->presetManager->setLexiconPreset($case); |
|
39 | + return $this->getCurrentPreset(); |
|
40 | + } |
|
41 | + } |
|
42 | + throw new OCSBadRequestException('Invalid preset name provided'); |
|
43 | + } |
|
44 | + |
|
45 | + public function getPreset(): DataResponse { |
|
46 | + return new DataResponse( |
|
47 | + [ |
|
48 | + 'preset' => $this->presetManager->retrieveLexiconPreset(), |
|
49 | + 'apps' => $this->presetManager->retrieveLexiconPresetApps() |
|
50 | + ] |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | } |
@@ -8,70 +8,70 @@ |
||
8 | 8 | * SPDX-License-Identifier: AGPL-3.0-only |
9 | 9 | */ |
10 | 10 | return [ |
11 | - 'resources' => [ |
|
12 | - 'AuthSettings' => ['url' => '/settings/personal/authtokens' , 'root' => ''], |
|
13 | - ], |
|
14 | - 'routes' => [ |
|
15 | - ['name' => 'AuthorizedGroup#saveSettings', 'url' => '/settings/authorizedgroups/saveSettings', 'verb' => 'POST'], |
|
11 | + 'resources' => [ |
|
12 | + 'AuthSettings' => ['url' => '/settings/personal/authtokens' , 'root' => ''], |
|
13 | + ], |
|
14 | + 'routes' => [ |
|
15 | + ['name' => 'AuthorizedGroup#saveSettings', 'url' => '/settings/authorizedgroups/saveSettings', 'verb' => 'POST'], |
|
16 | 16 | |
17 | - ['name' => 'AuthSettings#wipe', 'url' => '/settings/personal/authtokens/wipe/{id}', 'verb' => 'POST' , 'root' => ''], |
|
17 | + ['name' => 'AuthSettings#wipe', 'url' => '/settings/personal/authtokens/wipe/{id}', 'verb' => 'POST' , 'root' => ''], |
|
18 | 18 | |
19 | - ['name' => 'MailSettings#setMailSettings', 'url' => '/settings/admin/mailsettings', 'verb' => 'POST' , 'root' => ''], |
|
20 | - ['name' => 'MailSettings#storeCredentials', 'url' => '/settings/admin/mailsettings/credentials', 'verb' => 'POST' , 'root' => ''], |
|
21 | - ['name' => 'MailSettings#sendTestMail', 'url' => '/settings/admin/mailtest', 'verb' => 'POST' , 'root' => ''], |
|
19 | + ['name' => 'MailSettings#setMailSettings', 'url' => '/settings/admin/mailsettings', 'verb' => 'POST' , 'root' => ''], |
|
20 | + ['name' => 'MailSettings#storeCredentials', 'url' => '/settings/admin/mailsettings/credentials', 'verb' => 'POST' , 'root' => ''], |
|
21 | + ['name' => 'MailSettings#sendTestMail', 'url' => '/settings/admin/mailtest', 'verb' => 'POST' , 'root' => ''], |
|
22 | 22 | |
23 | - ['name' => 'AppSettings#getAppDiscoverJSON', 'url' => '/settings/api/apps/discover', 'verb' => 'GET', 'root' => ''], |
|
24 | - ['name' => 'AppSettings#getAppDiscoverMedia', 'url' => '/settings/api/apps/media', 'verb' => 'GET', 'root' => ''], |
|
25 | - ['name' => 'AppSettings#listCategories', 'url' => '/settings/apps/categories', 'verb' => 'GET' , 'root' => ''], |
|
26 | - ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps', 'verb' => 'GET' , 'root' => ''], |
|
27 | - ['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET' , 'root' => ''], |
|
28 | - ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
29 | - ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'POST' , 'root' => ''], |
|
30 | - ['name' => 'AppSettings#enableApps', 'url' => '/settings/apps/enable', 'verb' => 'POST' , 'root' => ''], |
|
31 | - ['name' => 'AppSettings#disableApp', 'url' => '/settings/apps/disable/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
32 | - ['name' => 'AppSettings#disableApps', 'url' => '/settings/apps/disable', 'verb' => 'POST' , 'root' => ''], |
|
33 | - ['name' => 'AppSettings#updateApp', 'url' => '/settings/apps/update/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
34 | - ['name' => 'AppSettings#uninstallApp', 'url' => '/settings/apps/uninstall/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
35 | - ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}', 'verb' => 'GET', 'defaults' => ['category' => ''] , 'root' => ''], |
|
36 | - ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}/{id}', 'verb' => 'GET', 'defaults' => ['category' => '', 'id' => ''] , 'root' => ''], |
|
37 | - ['name' => 'AppSettings#force', 'url' => '/settings/apps/force', 'verb' => 'POST' , 'root' => ''], |
|
23 | + ['name' => 'AppSettings#getAppDiscoverJSON', 'url' => '/settings/api/apps/discover', 'verb' => 'GET', 'root' => ''], |
|
24 | + ['name' => 'AppSettings#getAppDiscoverMedia', 'url' => '/settings/api/apps/media', 'verb' => 'GET', 'root' => ''], |
|
25 | + ['name' => 'AppSettings#listCategories', 'url' => '/settings/apps/categories', 'verb' => 'GET' , 'root' => ''], |
|
26 | + ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps', 'verb' => 'GET' , 'root' => ''], |
|
27 | + ['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET' , 'root' => ''], |
|
28 | + ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
29 | + ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'POST' , 'root' => ''], |
|
30 | + ['name' => 'AppSettings#enableApps', 'url' => '/settings/apps/enable', 'verb' => 'POST' , 'root' => ''], |
|
31 | + ['name' => 'AppSettings#disableApp', 'url' => '/settings/apps/disable/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
32 | + ['name' => 'AppSettings#disableApps', 'url' => '/settings/apps/disable', 'verb' => 'POST' , 'root' => ''], |
|
33 | + ['name' => 'AppSettings#updateApp', 'url' => '/settings/apps/update/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
34 | + ['name' => 'AppSettings#uninstallApp', 'url' => '/settings/apps/uninstall/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
35 | + ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}', 'verb' => 'GET', 'defaults' => ['category' => ''] , 'root' => ''], |
|
36 | + ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}/{id}', 'verb' => 'GET', 'defaults' => ['category' => '', 'id' => ''] , 'root' => ''], |
|
37 | + ['name' => 'AppSettings#force', 'url' => '/settings/apps/force', 'verb' => 'POST' , 'root' => ''], |
|
38 | 38 | |
39 | - ['name' => 'Users#setDisplayName', 'url' => '/settings/users/{username}/displayName', 'verb' => 'POST' , 'root' => ''], |
|
40 | - ['name' => 'Users#setEMailAddress', 'url' => '/settings/users/{id}/mailAddress', 'verb' => 'PUT' , 'root' => ''], |
|
41 | - ['name' => 'Users#setUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'PUT' , 'root' => ''], |
|
42 | - ['name' => 'Users#getVerificationCode', 'url' => '/settings/users/{account}/verify', 'verb' => 'GET' , 'root' => ''], |
|
43 | - ['name' => 'Users#usersList', 'url' => '/settings/users', 'verb' => 'GET' , 'root' => ''], |
|
44 | - ['name' => 'Users#usersListByGroup', 'url' => '/settings/users/{group}', 'verb' => 'GET', 'requirements' => ['group' => '.+'] , 'root' => ''], |
|
45 | - ['name' => 'Users#setPreference', 'url' => '/settings/users/preferences/{key}', 'verb' => 'POST' , 'root' => ''], |
|
46 | - ['name' => 'LogSettings#download', 'url' => '/settings/admin/log/download', 'verb' => 'GET' , 'root' => ''], |
|
47 | - ['name' => 'CheckSetup#setupCheckManager', 'url' => '/settings/setupcheck', 'verb' => 'GET' , 'root' => ''], |
|
48 | - ['name' => 'CheckSetup#check', 'url' => '/settings/ajax/checksetup', 'verb' => 'GET' , 'root' => ''], |
|
49 | - ['name' => 'CheckSetup#getFailedIntegrityCheckFiles', 'url' => '/settings/integrity/failed', 'verb' => 'GET' , 'root' => ''], |
|
50 | - ['name' => 'CheckSetup#rescanFailedIntegrityCheck', 'url' => '/settings/integrity/rescan', 'verb' => 'GET' , 'root' => ''], |
|
51 | - ['name' => 'PersonalSettings#index', 'url' => '/settings/user/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'personal-info'] , 'root' => ''], |
|
52 | - ['name' => 'AdminSettings#index', 'url' => '/settings/admin/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'server'] , 'root' => ''], |
|
53 | - ['name' => 'AdminSettings#form', 'url' => '/settings/admin/{section}', 'verb' => 'GET' , 'root' => ''], |
|
54 | - ['name' => 'ChangePassword#changePersonalPassword', 'url' => '/settings/personal/changepassword', 'verb' => 'POST' , 'root' => ''], |
|
55 | - ['name' => 'ChangePassword#changeUserPassword', 'url' => '/settings/users/changepassword', 'verb' => 'POST' , 'root' => ''], |
|
56 | - ['name' => 'TwoFactorSettings#index', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'GET' , 'root' => ''], |
|
57 | - ['name' => 'TwoFactorSettings#update', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'PUT' , 'root' => ''], |
|
58 | - ['name' => 'AISettings#update', 'url' => '/settings/api/admin/ai', 'verb' => 'PUT' , 'root' => ''], |
|
39 | + ['name' => 'Users#setDisplayName', 'url' => '/settings/users/{username}/displayName', 'verb' => 'POST' , 'root' => ''], |
|
40 | + ['name' => 'Users#setEMailAddress', 'url' => '/settings/users/{id}/mailAddress', 'verb' => 'PUT' , 'root' => ''], |
|
41 | + ['name' => 'Users#setUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'PUT' , 'root' => ''], |
|
42 | + ['name' => 'Users#getVerificationCode', 'url' => '/settings/users/{account}/verify', 'verb' => 'GET' , 'root' => ''], |
|
43 | + ['name' => 'Users#usersList', 'url' => '/settings/users', 'verb' => 'GET' , 'root' => ''], |
|
44 | + ['name' => 'Users#usersListByGroup', 'url' => '/settings/users/{group}', 'verb' => 'GET', 'requirements' => ['group' => '.+'] , 'root' => ''], |
|
45 | + ['name' => 'Users#setPreference', 'url' => '/settings/users/preferences/{key}', 'verb' => 'POST' , 'root' => ''], |
|
46 | + ['name' => 'LogSettings#download', 'url' => '/settings/admin/log/download', 'verb' => 'GET' , 'root' => ''], |
|
47 | + ['name' => 'CheckSetup#setupCheckManager', 'url' => '/settings/setupcheck', 'verb' => 'GET' , 'root' => ''], |
|
48 | + ['name' => 'CheckSetup#check', 'url' => '/settings/ajax/checksetup', 'verb' => 'GET' , 'root' => ''], |
|
49 | + ['name' => 'CheckSetup#getFailedIntegrityCheckFiles', 'url' => '/settings/integrity/failed', 'verb' => 'GET' , 'root' => ''], |
|
50 | + ['name' => 'CheckSetup#rescanFailedIntegrityCheck', 'url' => '/settings/integrity/rescan', 'verb' => 'GET' , 'root' => ''], |
|
51 | + ['name' => 'PersonalSettings#index', 'url' => '/settings/user/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'personal-info'] , 'root' => ''], |
|
52 | + ['name' => 'AdminSettings#index', 'url' => '/settings/admin/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'server'] , 'root' => ''], |
|
53 | + ['name' => 'AdminSettings#form', 'url' => '/settings/admin/{section}', 'verb' => 'GET' , 'root' => ''], |
|
54 | + ['name' => 'ChangePassword#changePersonalPassword', 'url' => '/settings/personal/changepassword', 'verb' => 'POST' , 'root' => ''], |
|
55 | + ['name' => 'ChangePassword#changeUserPassword', 'url' => '/settings/users/changepassword', 'verb' => 'POST' , 'root' => ''], |
|
56 | + ['name' => 'TwoFactorSettings#index', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'GET' , 'root' => ''], |
|
57 | + ['name' => 'TwoFactorSettings#update', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'PUT' , 'root' => ''], |
|
58 | + ['name' => 'AISettings#update', 'url' => '/settings/api/admin/ai', 'verb' => 'PUT' , 'root' => ''], |
|
59 | 59 | |
60 | - ['name' => 'Preset#getPreset', 'url' => '/settings/preset', 'verb' => 'GET' , 'root' => ''], |
|
61 | - ['name' => 'Preset#getCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'GET' , 'root' => ''], |
|
62 | - ['name' => 'Preset#setCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'POST' , 'root' => ''], |
|
60 | + ['name' => 'Preset#getPreset', 'url' => '/settings/preset', 'verb' => 'GET' , 'root' => ''], |
|
61 | + ['name' => 'Preset#getCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'GET' , 'root' => ''], |
|
62 | + ['name' => 'Preset#setCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'POST' , 'root' => ''], |
|
63 | 63 | |
64 | - ['name' => 'Help#help', 'url' => '/settings/help/{mode}', 'verb' => 'GET', 'defaults' => ['mode' => ''] , 'root' => ''], |
|
64 | + ['name' => 'Help#help', 'url' => '/settings/help/{mode}', 'verb' => 'GET', 'defaults' => ['mode' => ''] , 'root' => ''], |
|
65 | 65 | |
66 | - ['name' => 'WebAuthn#startRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'GET' , 'root' => ''], |
|
67 | - ['name' => 'WebAuthn#finishRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'POST' , 'root' => ''], |
|
68 | - ['name' => 'WebAuthn#deleteRegistration', 'url' => '/settings/api/personal/webauthn/registration/{id}', 'verb' => 'DELETE' , 'root' => ''], |
|
66 | + ['name' => 'WebAuthn#startRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'GET' , 'root' => ''], |
|
67 | + ['name' => 'WebAuthn#finishRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'POST' , 'root' => ''], |
|
68 | + ['name' => 'WebAuthn#deleteRegistration', 'url' => '/settings/api/personal/webauthn/registration/{id}', 'verb' => 'DELETE' , 'root' => ''], |
|
69 | 69 | |
70 | - ['name' => 'Reasons#getPdf', 'url' => '/settings/download/reasons', 'verb' => 'GET', 'root' => ''], |
|
71 | - ], |
|
72 | - 'ocs' => [ |
|
73 | - ['name' => 'DeclarativeSettings#setValue', 'url' => '/settings/api/declarative/value', 'verb' => 'POST', 'root' => ''], |
|
74 | - ['name' => 'DeclarativeSettings#setSensitiveValue', 'url' => '/settings/api/declarative/value-sensitive', 'verb' => 'POST', 'root' => ''], |
|
75 | - ['name' => 'DeclarativeSettings#getForms', 'url' => '/settings/api/declarative/forms', 'verb' => 'GET', 'root' => ''], |
|
76 | - ], |
|
70 | + ['name' => 'Reasons#getPdf', 'url' => '/settings/download/reasons', 'verb' => 'GET', 'root' => ''], |
|
71 | + ], |
|
72 | + 'ocs' => [ |
|
73 | + ['name' => 'DeclarativeSettings#setValue', 'url' => '/settings/api/declarative/value', 'verb' => 'POST', 'root' => ''], |
|
74 | + ['name' => 'DeclarativeSettings#setSensitiveValue', 'url' => '/settings/api/declarative/value-sensitive', 'verb' => 'POST', 'root' => ''], |
|
75 | + ['name' => 'DeclarativeSettings#getForms', 'url' => '/settings/api/declarative/forms', 'verb' => 'GET', 'root' => ''], |
|
76 | + ], |
|
77 | 77 | ]; |
@@ -9,63 +9,63 @@ |
||
9 | 9 | */ |
10 | 10 | return [ |
11 | 11 | 'resources' => [ |
12 | - 'AuthSettings' => ['url' => '/settings/personal/authtokens' , 'root' => ''], |
|
12 | + 'AuthSettings' => ['url' => '/settings/personal/authtokens', 'root' => ''], |
|
13 | 13 | ], |
14 | 14 | 'routes' => [ |
15 | 15 | ['name' => 'AuthorizedGroup#saveSettings', 'url' => '/settings/authorizedgroups/saveSettings', 'verb' => 'POST'], |
16 | 16 | |
17 | - ['name' => 'AuthSettings#wipe', 'url' => '/settings/personal/authtokens/wipe/{id}', 'verb' => 'POST' , 'root' => ''], |
|
17 | + ['name' => 'AuthSettings#wipe', 'url' => '/settings/personal/authtokens/wipe/{id}', 'verb' => 'POST', 'root' => ''], |
|
18 | 18 | |
19 | - ['name' => 'MailSettings#setMailSettings', 'url' => '/settings/admin/mailsettings', 'verb' => 'POST' , 'root' => ''], |
|
20 | - ['name' => 'MailSettings#storeCredentials', 'url' => '/settings/admin/mailsettings/credentials', 'verb' => 'POST' , 'root' => ''], |
|
21 | - ['name' => 'MailSettings#sendTestMail', 'url' => '/settings/admin/mailtest', 'verb' => 'POST' , 'root' => ''], |
|
19 | + ['name' => 'MailSettings#setMailSettings', 'url' => '/settings/admin/mailsettings', 'verb' => 'POST', 'root' => ''], |
|
20 | + ['name' => 'MailSettings#storeCredentials', 'url' => '/settings/admin/mailsettings/credentials', 'verb' => 'POST', 'root' => ''], |
|
21 | + ['name' => 'MailSettings#sendTestMail', 'url' => '/settings/admin/mailtest', 'verb' => 'POST', 'root' => ''], |
|
22 | 22 | |
23 | 23 | ['name' => 'AppSettings#getAppDiscoverJSON', 'url' => '/settings/api/apps/discover', 'verb' => 'GET', 'root' => ''], |
24 | 24 | ['name' => 'AppSettings#getAppDiscoverMedia', 'url' => '/settings/api/apps/media', 'verb' => 'GET', 'root' => ''], |
25 | - ['name' => 'AppSettings#listCategories', 'url' => '/settings/apps/categories', 'verb' => 'GET' , 'root' => ''], |
|
26 | - ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps', 'verb' => 'GET' , 'root' => ''], |
|
27 | - ['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET' , 'root' => ''], |
|
28 | - ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
29 | - ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'POST' , 'root' => ''], |
|
30 | - ['name' => 'AppSettings#enableApps', 'url' => '/settings/apps/enable', 'verb' => 'POST' , 'root' => ''], |
|
31 | - ['name' => 'AppSettings#disableApp', 'url' => '/settings/apps/disable/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
32 | - ['name' => 'AppSettings#disableApps', 'url' => '/settings/apps/disable', 'verb' => 'POST' , 'root' => ''], |
|
33 | - ['name' => 'AppSettings#updateApp', 'url' => '/settings/apps/update/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
34 | - ['name' => 'AppSettings#uninstallApp', 'url' => '/settings/apps/uninstall/{appId}', 'verb' => 'GET' , 'root' => ''], |
|
35 | - ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}', 'verb' => 'GET', 'defaults' => ['category' => ''] , 'root' => ''], |
|
36 | - ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}/{id}', 'verb' => 'GET', 'defaults' => ['category' => '', 'id' => ''] , 'root' => ''], |
|
37 | - ['name' => 'AppSettings#force', 'url' => '/settings/apps/force', 'verb' => 'POST' , 'root' => ''], |
|
25 | + ['name' => 'AppSettings#listCategories', 'url' => '/settings/apps/categories', 'verb' => 'GET', 'root' => ''], |
|
26 | + ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps', 'verb' => 'GET', 'root' => ''], |
|
27 | + ['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET', 'root' => ''], |
|
28 | + ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'GET', 'root' => ''], |
|
29 | + ['name' => 'AppSettings#enableApp', 'url' => '/settings/apps/enable/{appId}', 'verb' => 'POST', 'root' => ''], |
|
30 | + ['name' => 'AppSettings#enableApps', 'url' => '/settings/apps/enable', 'verb' => 'POST', 'root' => ''], |
|
31 | + ['name' => 'AppSettings#disableApp', 'url' => '/settings/apps/disable/{appId}', 'verb' => 'GET', 'root' => ''], |
|
32 | + ['name' => 'AppSettings#disableApps', 'url' => '/settings/apps/disable', 'verb' => 'POST', 'root' => ''], |
|
33 | + ['name' => 'AppSettings#updateApp', 'url' => '/settings/apps/update/{appId}', 'verb' => 'GET', 'root' => ''], |
|
34 | + ['name' => 'AppSettings#uninstallApp', 'url' => '/settings/apps/uninstall/{appId}', 'verb' => 'GET', 'root' => ''], |
|
35 | + ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}', 'verb' => 'GET', 'defaults' => ['category' => ''], 'root' => ''], |
|
36 | + ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps/{category}/{id}', 'verb' => 'GET', 'defaults' => ['category' => '', 'id' => ''], 'root' => ''], |
|
37 | + ['name' => 'AppSettings#force', 'url' => '/settings/apps/force', 'verb' => 'POST', 'root' => ''], |
|
38 | 38 | |
39 | - ['name' => 'Users#setDisplayName', 'url' => '/settings/users/{username}/displayName', 'verb' => 'POST' , 'root' => ''], |
|
40 | - ['name' => 'Users#setEMailAddress', 'url' => '/settings/users/{id}/mailAddress', 'verb' => 'PUT' , 'root' => ''], |
|
41 | - ['name' => 'Users#setUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'PUT' , 'root' => ''], |
|
42 | - ['name' => 'Users#getVerificationCode', 'url' => '/settings/users/{account}/verify', 'verb' => 'GET' , 'root' => ''], |
|
43 | - ['name' => 'Users#usersList', 'url' => '/settings/users', 'verb' => 'GET' , 'root' => ''], |
|
44 | - ['name' => 'Users#usersListByGroup', 'url' => '/settings/users/{group}', 'verb' => 'GET', 'requirements' => ['group' => '.+'] , 'root' => ''], |
|
45 | - ['name' => 'Users#setPreference', 'url' => '/settings/users/preferences/{key}', 'verb' => 'POST' , 'root' => ''], |
|
46 | - ['name' => 'LogSettings#download', 'url' => '/settings/admin/log/download', 'verb' => 'GET' , 'root' => ''], |
|
47 | - ['name' => 'CheckSetup#setupCheckManager', 'url' => '/settings/setupcheck', 'verb' => 'GET' , 'root' => ''], |
|
48 | - ['name' => 'CheckSetup#check', 'url' => '/settings/ajax/checksetup', 'verb' => 'GET' , 'root' => ''], |
|
49 | - ['name' => 'CheckSetup#getFailedIntegrityCheckFiles', 'url' => '/settings/integrity/failed', 'verb' => 'GET' , 'root' => ''], |
|
50 | - ['name' => 'CheckSetup#rescanFailedIntegrityCheck', 'url' => '/settings/integrity/rescan', 'verb' => 'GET' , 'root' => ''], |
|
51 | - ['name' => 'PersonalSettings#index', 'url' => '/settings/user/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'personal-info'] , 'root' => ''], |
|
52 | - ['name' => 'AdminSettings#index', 'url' => '/settings/admin/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'server'] , 'root' => ''], |
|
53 | - ['name' => 'AdminSettings#form', 'url' => '/settings/admin/{section}', 'verb' => 'GET' , 'root' => ''], |
|
54 | - ['name' => 'ChangePassword#changePersonalPassword', 'url' => '/settings/personal/changepassword', 'verb' => 'POST' , 'root' => ''], |
|
55 | - ['name' => 'ChangePassword#changeUserPassword', 'url' => '/settings/users/changepassword', 'verb' => 'POST' , 'root' => ''], |
|
56 | - ['name' => 'TwoFactorSettings#index', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'GET' , 'root' => ''], |
|
57 | - ['name' => 'TwoFactorSettings#update', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'PUT' , 'root' => ''], |
|
58 | - ['name' => 'AISettings#update', 'url' => '/settings/api/admin/ai', 'verb' => 'PUT' , 'root' => ''], |
|
39 | + ['name' => 'Users#setDisplayName', 'url' => '/settings/users/{username}/displayName', 'verb' => 'POST', 'root' => ''], |
|
40 | + ['name' => 'Users#setEMailAddress', 'url' => '/settings/users/{id}/mailAddress', 'verb' => 'PUT', 'root' => ''], |
|
41 | + ['name' => 'Users#setUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'PUT', 'root' => ''], |
|
42 | + ['name' => 'Users#getVerificationCode', 'url' => '/settings/users/{account}/verify', 'verb' => 'GET', 'root' => ''], |
|
43 | + ['name' => 'Users#usersList', 'url' => '/settings/users', 'verb' => 'GET', 'root' => ''], |
|
44 | + ['name' => 'Users#usersListByGroup', 'url' => '/settings/users/{group}', 'verb' => 'GET', 'requirements' => ['group' => '.+'], 'root' => ''], |
|
45 | + ['name' => 'Users#setPreference', 'url' => '/settings/users/preferences/{key}', 'verb' => 'POST', 'root' => ''], |
|
46 | + ['name' => 'LogSettings#download', 'url' => '/settings/admin/log/download', 'verb' => 'GET', 'root' => ''], |
|
47 | + ['name' => 'CheckSetup#setupCheckManager', 'url' => '/settings/setupcheck', 'verb' => 'GET', 'root' => ''], |
|
48 | + ['name' => 'CheckSetup#check', 'url' => '/settings/ajax/checksetup', 'verb' => 'GET', 'root' => ''], |
|
49 | + ['name' => 'CheckSetup#getFailedIntegrityCheckFiles', 'url' => '/settings/integrity/failed', 'verb' => 'GET', 'root' => ''], |
|
50 | + ['name' => 'CheckSetup#rescanFailedIntegrityCheck', 'url' => '/settings/integrity/rescan', 'verb' => 'GET', 'root' => ''], |
|
51 | + ['name' => 'PersonalSettings#index', 'url' => '/settings/user/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'personal-info'], 'root' => ''], |
|
52 | + ['name' => 'AdminSettings#index', 'url' => '/settings/admin/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'server'], 'root' => ''], |
|
53 | + ['name' => 'AdminSettings#form', 'url' => '/settings/admin/{section}', 'verb' => 'GET', 'root' => ''], |
|
54 | + ['name' => 'ChangePassword#changePersonalPassword', 'url' => '/settings/personal/changepassword', 'verb' => 'POST', 'root' => ''], |
|
55 | + ['name' => 'ChangePassword#changeUserPassword', 'url' => '/settings/users/changepassword', 'verb' => 'POST', 'root' => ''], |
|
56 | + ['name' => 'TwoFactorSettings#index', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'GET', 'root' => ''], |
|
57 | + ['name' => 'TwoFactorSettings#update', 'url' => '/settings/api/admin/twofactorauth', 'verb' => 'PUT', 'root' => ''], |
|
58 | + ['name' => 'AISettings#update', 'url' => '/settings/api/admin/ai', 'verb' => 'PUT', 'root' => ''], |
|
59 | 59 | |
60 | - ['name' => 'Preset#getPreset', 'url' => '/settings/preset', 'verb' => 'GET' , 'root' => ''], |
|
61 | - ['name' => 'Preset#getCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'GET' , 'root' => ''], |
|
62 | - ['name' => 'Preset#setCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'POST' , 'root' => ''], |
|
60 | + ['name' => 'Preset#getPreset', 'url' => '/settings/preset', 'verb' => 'GET', 'root' => ''], |
|
61 | + ['name' => 'Preset#getCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'GET', 'root' => ''], |
|
62 | + ['name' => 'Preset#setCurrentPreset', 'url' => '/settings/preset/current', 'verb' => 'POST', 'root' => ''], |
|
63 | 63 | |
64 | - ['name' => 'Help#help', 'url' => '/settings/help/{mode}', 'verb' => 'GET', 'defaults' => ['mode' => ''] , 'root' => ''], |
|
64 | + ['name' => 'Help#help', 'url' => '/settings/help/{mode}', 'verb' => 'GET', 'defaults' => ['mode' => ''], 'root' => ''], |
|
65 | 65 | |
66 | - ['name' => 'WebAuthn#startRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'GET' , 'root' => ''], |
|
67 | - ['name' => 'WebAuthn#finishRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'POST' , 'root' => ''], |
|
68 | - ['name' => 'WebAuthn#deleteRegistration', 'url' => '/settings/api/personal/webauthn/registration/{id}', 'verb' => 'DELETE' , 'root' => ''], |
|
66 | + ['name' => 'WebAuthn#startRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'GET', 'root' => ''], |
|
67 | + ['name' => 'WebAuthn#finishRegistration', 'url' => '/settings/api/personal/webauthn/registration', 'verb' => 'POST', 'root' => ''], |
|
68 | + ['name' => 'WebAuthn#deleteRegistration', 'url' => '/settings/api/personal/webauthn/registration/{id}', 'verb' => 'DELETE', 'root' => ''], |
|
69 | 69 | |
70 | 70 | ['name' => 'Reasons#getPdf', 'url' => '/settings/download/reasons', 'verb' => 'GET', 'root' => ''], |
71 | 71 | ], |