mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
fix(search): Fix SearchComposer.php filtering logic
keep the $this->providers types
Test via ./occ config:app:set --value '["files","settings"]' --type array core unified_search.providers_allowed
should be part of 8e570041
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
This commit is contained in:
parent
dc699a2597
commit
91d4437a84
1 changed files with 10 additions and 8 deletions
|
|
@ -118,7 +118,7 @@ class SearchComposer {
|
|||
}
|
||||
}
|
||||
|
||||
$this->providers = $this->filterProviders($this->providers);
|
||||
$this->filterProviders();
|
||||
|
||||
$this->loadFilters();
|
||||
}
|
||||
|
|
@ -211,19 +211,21 @@ class SearchComposer {
|
|||
|
||||
/**
|
||||
* Filter providers based on 'unified_search.providers_allowed' core app config array
|
||||
* @param array $providers
|
||||
* @return array
|
||||
* Will remove providers that are not in the allowed list
|
||||
*/
|
||||
private function filterProviders(array $providers): array {
|
||||
private function filterProviders(): void {
|
||||
$allowedProviders = $this->appConfig->getValueArray('core', 'unified_search.providers_allowed');
|
||||
|
||||
if (empty($allowedProviders)) {
|
||||
return $providers;
|
||||
return;
|
||||
}
|
||||
|
||||
return array_values(array_filter($providers, function ($p) use ($allowedProviders) {
|
||||
return in_array($p['id'], $allowedProviders);
|
||||
}));
|
||||
foreach (array_keys($this->providers) as $providerId) {
|
||||
if (!in_array($providerId, $allowedProviders, true)) {
|
||||
unset($this->providers[$providerId]);
|
||||
unset($this->handlers[$providerId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function fetchIcon(string $appId, string $providerId): string {
|
||||
|
|
|
|||
Loading…
Reference in a new issue