IManager.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Lukas Reschke <lukas@statuscode.ch>
  9. * @author Kate Döen <kate.doeen@nextcloud.com>
  10. *
  11. * @license GNU AGPL version 3 or any later version
  12. *
  13. * This program is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License as
  15. * published by the Free Software Foundation, either version 3 of the
  16. * License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. *
  26. */
  27. namespace OCP\Settings;
  28. use OCP\IUser;
  29. /**
  30. * @since 9.1
  31. */
  32. interface IManager {
  33. /**
  34. * @since 9.1.0
  35. * @deprecated 29.0.0 Use {@see self::SETTINGS_ADMIN} instead
  36. */
  37. public const KEY_ADMIN_SETTINGS = 'admin';
  38. /**
  39. * @since 9.1.0
  40. * @deprecated 29.0.0 Use {@see self::SETTINGS_ADMIN} instead
  41. */
  42. public const KEY_ADMIN_SECTION = 'admin-section';
  43. /**
  44. * @since 13.0.0
  45. * @deprecated 29.0.0 Use {@see self::SETTINGS_PERSONAL} instead
  46. */
  47. public const KEY_PERSONAL_SETTINGS = 'personal';
  48. /**
  49. * @since 13.0.0
  50. * @deprecated 29.0.0 Use {@see self::SETTINGS_PERSONAL} instead
  51. */
  52. public const KEY_PERSONAL_SECTION = 'personal-section';
  53. /**
  54. * @since 29.0.0
  55. */
  56. public const SETTINGS_ADMIN = 'admin';
  57. /**
  58. * @since 29.0.0
  59. */
  60. public const SETTINGS_PERSONAL = 'personal';
  61. /**
  62. * @psalm-param self::SETTINGS_* $type
  63. * @param class-string<IIconSection> $section
  64. * @since 14.0.0
  65. */
  66. public function registerSection(string $type, string $section);
  67. /**
  68. * @psalm-param self::SETTINGS_* $type
  69. * @param class-string<ISettings> $setting
  70. * @since 14.0.0
  71. */
  72. public function registerSetting(string $type, string $setting);
  73. /**
  74. * returns a list of the admin sections
  75. *
  76. * @return array<int, list<IIconSection>> list of sections with priority as key
  77. * @since 9.1.0
  78. */
  79. public function getAdminSections(): array;
  80. /**
  81. * returns a list of the personal sections
  82. *
  83. * @return array<int, list<IIconSection>> list of sections with priority as key
  84. * @since 13.0.0
  85. */
  86. public function getPersonalSections(): array;
  87. /**
  88. * returns a list of the admin settings
  89. *
  90. * @param string $section the section id for which to load the settings
  91. * @param bool $subAdminOnly only return settings sub admins are supposed to see (since 17.0.0)
  92. * @return array<int, list<ISettings>> list of settings with priority as key
  93. * @since 9.1.0
  94. */
  95. public function getAdminSettings(string $section, bool $subAdminOnly = false): array;
  96. /**
  97. * Returns a list of admin settings that the given user can use for the give section
  98. *
  99. * @return array<int, list<ISettings>> The array of admin settings there admin delegation is allowed.
  100. * @since 23.0.0
  101. */
  102. public function getAllowedAdminSettings(string $section, IUser $user): array;
  103. /**
  104. * Returns a list of admin settings that the given user can use.
  105. *
  106. * @return list<ISettings> The array of admin settings there admin delegation is allowed.
  107. * @since 23.0.0
  108. */
  109. public function getAllAllowedAdminSettings(IUser $user): array;
  110. /**
  111. * returns a list of the personal settings
  112. *
  113. * @param string $section the section id for which to load the settings
  114. * @return array<int, list<ISettings>> list of settings with priority as key
  115. * @since 13.0.0
  116. */
  117. public function getPersonalSettings(string $section): array;
  118. /**
  119. * Get a specific section by type and id
  120. * @psalm-param self::SETTINGS_* $type
  121. * @since 25.0.0
  122. */
  123. public function getSection(string $type, string $sectionId): ?IIconSection;
  124. }