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.

106 lines
4.3 KiB

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Core\AppInfo;
  8. use OCP\Config\Lexicon\Entry;
  9. use OCP\Config\Lexicon\ILexicon;
  10. use OCP\Config\Lexicon\Preset;
  11. use OCP\Config\Lexicon\Strictness;
  12. use OCP\Config\ValueType;
  13. /**
  14. * Config Lexicon for core.
  15. *
  16. * Please Add & Manage your Config Keys in that file and keep the Lexicon up to date!
  17. */
  18. class ConfigLexicon implements ILexicon {
  19. public const SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES = 'shareapi_allow_federation_on_public_shares';
  20. public const SHARE_CUSTOM_TOKEN = 'shareapi_allow_custom_tokens';
  21. public const SHARE_LINK_PASSWORD_DEFAULT = 'shareapi_enable_link_password_by_default';
  22. public const SHARE_LINK_PASSWORD_ENFORCED = 'shareapi_enforce_links_password';
  23. public const SHARE_LINK_EXPIRE_DATE_DEFAULT = 'shareapi_default_expire_date';
  24. public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date';
  25. public const USER_LANGUAGE = 'lang';
  26. public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled';
  27. public const OCM_INVITE_ACCEPT_DIALOG = 'ocm_invite_accept_dialog';
  28. public const USER_LOCALE = 'locale';
  29. public const USER_TIMEZONE = 'timezone';
  30. public const UNIFIED_SEARCH_MIN_SEARCH_LENGTH = 'unified_search_min_search_length';
  31. public const UNIFIED_SEARCH_MAX_RESULTS_PER_REQUEST = 'unified_search_max_results_per_request';
  32. public const LASTCRON_TIMESTAMP = 'lastcron';
  33. public function getStrictness(): Strictness {
  34. return Strictness::IGNORE;
  35. }
  36. public function getAppConfigs(): array {
  37. return [
  38. new Entry(
  39. key: self::SHAREAPI_ALLOW_FEDERATION_ON_PUBLIC_SHARES,
  40. type: ValueType::BOOL,
  41. defaultRaw: true,
  42. definition: 'adds share permission to public shares to allow adding them to your Nextcloud (federation)',
  43. ),
  44. new Entry(
  45. key: self::SHARE_CUSTOM_TOKEN,
  46. type: ValueType::BOOL,
  47. defaultRaw: fn (Preset $p): bool => match ($p) {
  48. Preset::FAMILY, Preset::PRIVATE => true,
  49. default => false,
  50. },
  51. definition: 'Allow users to customize share URL',
  52. note: 'Shares with guessable tokens may be accessed easily. Shares with custom tokens will continue to be accessible after this setting has been disabled.',
  53. ),
  54. new Entry(self::SHARE_LINK_PASSWORD_DEFAULT, ValueType::BOOL, false, 'Ask for a password when sharing document by default'),
  55. new Entry(
  56. key: self::SHARE_LINK_PASSWORD_ENFORCED,
  57. type: ValueType::BOOL,
  58. defaultRaw: fn (Preset $p): bool => match ($p) {
  59. Preset::SCHOOL, Preset::UNIVERSITY, Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true,
  60. default => false,
  61. },
  62. definition: 'Enforce password protection for shared documents'
  63. ),
  64. new Entry(
  65. key: self::SHARE_LINK_EXPIRE_DATE_DEFAULT,
  66. type: ValueType::BOOL,
  67. defaultRaw: fn (Preset $p): bool => match ($p) {
  68. Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true,
  69. default => false,
  70. },
  71. definition: 'Default expiration date for shares via link or mail'
  72. ),
  73. new Entry(
  74. key: self::SHARE_LINK_EXPIRE_DATE_ENFORCED,
  75. type: ValueType::BOOL,
  76. defaultRaw: fn (Preset $p): bool => match ($p) {
  77. Preset::SHARED, Preset::SMALL, Preset::MEDIUM, Preset::LARGE => true,
  78. default => false,
  79. },
  80. definition: 'Enforce expiration date for shares via link or mail'
  81. ),
  82. new Entry(self::LASTCRON_TIMESTAMP, ValueType::INT, 0, 'timestamp of last cron execution'),
  83. new Entry(self::OCM_DISCOVERY_ENABLED, ValueType::BOOL, true, 'enable/disable OCM'),
  84. new Entry(self::OCM_INVITE_ACCEPT_DIALOG, ValueType::STRING, '', 'route to local invite accept dialog', note: 'set as empty string to disable feature'),
  85. new Entry(self::UNIFIED_SEARCH_MIN_SEARCH_LENGTH, ValueType::INT, 1, 'Minimum search length to trigger the request', rename: 'unified-search.min-search-length'),
  86. new Entry(self::UNIFIED_SEARCH_MAX_RESULTS_PER_REQUEST, ValueType::INT, 25, 'Maximum results returned per search request', rename: 'unified-search.max-results-per-request'),
  87. ];
  88. }
  89. public function getUserConfigs(): array {
  90. return [
  91. new Entry(self::USER_LANGUAGE, ValueType::STRING, definition: 'language'),
  92. new Entry(self::USER_LOCALE, ValueType::STRING, definition: 'locale'),
  93. new Entry(self::USER_TIMEZONE, ValueType::STRING, definition: 'timezone'),
  94. ];
  95. }
  96. }