You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
2.7 KiB

  1. # Copyright 2017 New Vector Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from ._base import Config
  15. class UserDirectoryConfig(Config):
  16. """User Directory Configuration
  17. Configuration for the behaviour of the /user_directory API
  18. """
  19. section = "userdirectory"
  20. def read_config(self, config, **kwargs):
  21. user_directory_config = config.get("user_directory") or {}
  22. self.user_directory_search_enabled = user_directory_config.get("enabled", True)
  23. self.user_directory_search_all_users = user_directory_config.get(
  24. "search_all_users", False
  25. )
  26. self.user_directory_search_prefer_local_users = user_directory_config.get(
  27. "prefer_local_users", False
  28. )
  29. def generate_config_section(self, config_dir_path, server_name, **kwargs):
  30. return """
  31. # User Directory configuration
  32. #
  33. user_directory:
  34. # Defines whether users can search the user directory. If false then
  35. # empty responses are returned to all queries. Defaults to true.
  36. #
  37. # Uncomment to disable the user directory.
  38. #
  39. #enabled: false
  40. # Defines whether to search all users visible to your HS when searching
  41. # the user directory, rather than limiting to users visible in public
  42. # rooms. Defaults to false.
  43. #
  44. # If you set it true, you'll have to rebuild the user_directory search
  45. # indexes, see:
  46. # https://github.com/matrix-org/synapse/blob/master/docs/user_directory.md
  47. #
  48. # Uncomment to return search results containing all known users, even if that
  49. # user does not share a room with the requester.
  50. #
  51. #search_all_users: true
  52. # Defines whether to prefer local users in search query results.
  53. # If True, local users are more likely to appear above remote users
  54. # when searching the user directory. Defaults to false.
  55. #
  56. # Uncomment to prefer local over remote users in user directory search
  57. # results.
  58. #
  59. #prefer_local_users: true
  60. """