Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reduce search providers per config value "unified_search_providers_allowed" #48841

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

printminion-co
Copy link
Contributor

@printminion-co printminion-co commented Oct 22, 2024

Summary

This feature should help to restrict not desired search providers by allowing only desired search providers.

Before

One can see the /ocs/v2.php/search/providers deliver various search providers (you may see other providers on your nextcloud instance depending on installed/disabled apps).
Selection_20241023-002

After feature activation

One can see we allowed only the files and settings search providers (since we do not want to allow any other search providers).

Selection_20241023-003

CLI Example: restrict search providers to files and settings

./occ config:system:set unified_search_providers_allowed 0 --value files 
./occ config:system:set unified_search_providers_allowed 1 --value settings
  • Resolves: #

TODO

  • ...

Checklist

Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

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

Is the endpoint also not responding when searching in disabled providers?

* @param array $providers
* @return array
*/
private function reduceProviders(array $providers): array {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private function reduceProviders(array $providers): array {
private function filterProviders(array $providers): array {

@sorbaugh sorbaugh requested a review from susnux October 22, 2024 15:13
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

I am not sure, as far as I know we do not have documentation about available search providers. So this config would be blind-guessing.
Maybe it is safer to make it an app config first until we have a occ command to list search providers?

@sorbaugh
Copy link
Contributor

would be blind-guessing. Maybe it is safer to make it an app config first until we have a occ command to list search providers?

@printminion-co would this be ok for you?

@printminion-co
Copy link
Contributor Author

printminion-co commented Oct 23, 2024

I am not sure, as far as I know we do not have documentation about available search providers. So this config would be blind-guessing.

I've added more description and screenshots to better describe the feature.
There is no blind-guessing since we allow and not disable the search providers.

Maybe it is safer to make it an app config first until we have a occ command to list search providers?

  • We know which providers we want keep enabled.
  • We do not need a listing.
  • Allowing not existing provider (e.g. foo) will not break the code

cc// @artonge @susnux @sorbaugh

…ders_allowed

reduce search providers by setting config value to unified_search_providers_allowed = [ 'files', 'setting' ]

./occ config:system:set unified_search_providers_allowed 0 --value files
./occ config:system:set unified_search_providers_allowed 1 --value settings

Signed-off-by: Misha M.-Kupriyanov <[email protected]>
@printminion-co printminion-co force-pushed the feat/config_unified_search_providers_allowed branch from 8939114 to a30aba1 Compare October 23, 2024 07:59
@susnux
Copy link
Contributor

susnux commented Oct 23, 2024

We know which providers we want keep enabled.
We do not need a listing.

For you this might be true, but my fear is that this will confuse other administrators of Nextcloud systems, because of the missing listing / documentation.

There is no blind-guessing since we allow and not disable the search providers.

Well if you know that API endpoint to retrive the available providers yes. What I meant is:
There is no list of available providers in the documentation and no OCC command to query it,
so this would be a feature mostly hidden and undocumented.

That is why I asked if instead of system config also an app config would work? Instead of writing it to the config.php just have it as an core app setting, we could later built an OCC command around it (listing + dis-/enable).

From my side no blocker, but just wanted to bring this up as this might lead to confusion in the future.

*
* For example: Set to ['files', 'settings'] to only allow file and settings search.
*/
'unified_search_providers_allowed' => [],
Copy link
Contributor

Choose a reason for hiding this comment

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

We should keep the same format for all related options:

Suggested change
'unified_search_providers_allowed' => [],
'unified_search.providers_allowed' => [],

@printminion-co
Copy link
Contributor Author

Instead of writing it to the config.php just have it as an core app setting, we could later built an OCC command around it (listing + dis-/enable).

I will check this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants