IManager.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\Settings;
  7. use OCP\IUser;
  8. /**
  9. * @since 9.1
  10. */
  11. interface IManager {
  12. /**
  13. * @since 9.1.0
  14. * @deprecated 29.0.0 Use {@see self::SETTINGS_ADMIN} instead
  15. */
  16. public const KEY_ADMIN_SETTINGS = 'admin';
  17. /**
  18. * @since 9.1.0
  19. * @deprecated 29.0.0 Use {@see self::SETTINGS_ADMIN} instead
  20. */
  21. public const KEY_ADMIN_SECTION = 'admin-section';
  22. /**
  23. * @since 13.0.0
  24. * @deprecated 29.0.0 Use {@see self::SETTINGS_PERSONAL} instead
  25. */
  26. public const KEY_PERSONAL_SETTINGS = 'personal';
  27. /**
  28. * @since 13.0.0
  29. * @deprecated 29.0.0 Use {@see self::SETTINGS_PERSONAL} instead
  30. */
  31. public const KEY_PERSONAL_SECTION = 'personal-section';
  32. /**
  33. * @since 29.0.0
  34. */
  35. public const SETTINGS_ADMIN = 'admin';
  36. /**
  37. * @since 29.0.0
  38. */
  39. public const SETTINGS_PERSONAL = 'personal';
  40. /**
  41. * @psalm-param self::SETTINGS_* $type
  42. * @param class-string<IIconSection> $section
  43. * @since 14.0.0
  44. */
  45. public function registerSection(string $type, string $section);
  46. /**
  47. * @psalm-param self::SETTINGS_* $type
  48. * @param class-string<ISettings> $setting
  49. * @since 14.0.0
  50. */
  51. public function registerSetting(string $type, string $setting);
  52. /**
  53. * returns a list of the admin sections
  54. *
  55. * @return array<int, list<IIconSection>> list of sections with priority as key
  56. * @since 9.1.0
  57. */
  58. public function getAdminSections(): array;
  59. /**
  60. * returns a list of the personal sections
  61. *
  62. * @return array<int, list<IIconSection>> list of sections with priority as key
  63. * @since 13.0.0
  64. */
  65. public function getPersonalSections(): array;
  66. /**
  67. * returns a list of the admin settings
  68. *
  69. * @param string $section the section id for which to load the settings
  70. * @param bool $subAdminOnly only return settings sub admins are supposed to see (since 17.0.0)
  71. * @return array<int, list<ISettings>> list of settings with priority as key
  72. * @since 9.1.0
  73. */
  74. public function getAdminSettings(string $section, bool $subAdminOnly = false): array;
  75. /**
  76. * Returns a list of admin settings that the given user can use for the give section
  77. *
  78. * @return array<int, list<ISettings>> The array of admin settings there admin delegation is allowed.
  79. * @since 23.0.0
  80. */
  81. public function getAllowedAdminSettings(string $section, IUser $user): array;
  82. /**
  83. * Returns a list of admin settings that the given user can use.
  84. *
  85. * @return list<ISettings> The array of admin settings there admin delegation is allowed.
  86. * @since 23.0.0
  87. */
  88. public function getAllAllowedAdminSettings(IUser $user): array;
  89. /**
  90. * returns a list of the personal settings
  91. *
  92. * @param string $section the section id for which to load the settings
  93. * @return array<int, list<ISettings>> list of settings with priority as key
  94. * @since 13.0.0
  95. */
  96. public function getPersonalSettings(string $section): array;
  97. /**
  98. * Get a specific section by type and id
  99. * @psalm-param self::SETTINGS_* $type
  100. * @since 25.0.0
  101. */
  102. public function getSection(string $type, string $sectionId): ?IIconSection;
  103. }