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.

IRegistrationContext.php 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Julius Härtl <jus@bitgrid.net>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  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\AppFramework\Bootstrap;
  28. use OCP\AppFramework\IAppContainer;
  29. use OCP\Authentication\TwoFactorAuth\IProvider;
  30. use OCP\Calendar\ICalendarProvider;
  31. use OCP\Capabilities\ICapability;
  32. use OCP\EventDispatcher\IEventDispatcher;
  33. use OCP\Files\Template\ICustomTemplateProvider;
  34. use OCP\IContainer;
  35. use OCP\Notification\INotifier;
  36. use OCP\Preview\IProviderV2;
  37. /**
  38. * The context object passed to IBootstrap::register
  39. *
  40. * @since 20.0.0
  41. * @see IBootstrap::register()
  42. */
  43. interface IRegistrationContext {
  44. /**
  45. * @param string $capability
  46. * @psalm-param class-string<ICapability> $capability
  47. * @see IAppContainer::registerCapability
  48. *
  49. * @since 20.0.0
  50. */
  51. public function registerCapability(string $capability): void;
  52. /**
  53. * Register an implementation of \OCP\Support\CrashReport\IReporter that
  54. * will receive unhandled exceptions and throwables
  55. *
  56. * @param string $reporterClass
  57. * @psalm-param class-string<\OCP\Support\CrashReport\IReporter> $reporterClass
  58. * @return void
  59. * @since 20.0.0
  60. */
  61. public function registerCrashReporter(string $reporterClass): void;
  62. /**
  63. * Register an implementation of \OCP\Dashboard\IWidget that
  64. * will handle the implementation of a dashboard widget
  65. *
  66. * @param string $widgetClass
  67. * @psalm-param class-string<\OCP\Dashboard\IWidget> $widgetClass
  68. * @return void
  69. * @since 20.0.0
  70. */
  71. public function registerDashboardWidget(string $widgetClass): void;
  72. /**
  73. * Register a service
  74. *
  75. * @param string $name
  76. * @param callable $factory
  77. * @psalm-param callable(\Psr\Container\ContainerInterface): mixed $factory
  78. * @param bool $shared
  79. *
  80. * @return void
  81. * @see IContainer::registerService()
  82. *
  83. * @since 20.0.0
  84. */
  85. public function registerService(string $name, callable $factory, bool $shared = true): void;
  86. /**
  87. * @param string $alias
  88. * @psalm-param string|class-string $alias
  89. * @param string $target
  90. * @psalm-param string|class-string $target
  91. *
  92. * @return void
  93. * @see IContainer::registerAlias()
  94. *
  95. * @since 20.0.0
  96. */
  97. public function registerServiceAlias(string $alias, string $target): void;
  98. /**
  99. * @param string $name
  100. * @param mixed $value
  101. *
  102. * @return void
  103. * @see IContainer::registerParameter()
  104. *
  105. * @since 20.0.0
  106. */
  107. public function registerParameter(string $name, $value): void;
  108. /**
  109. * Register a service listener
  110. *
  111. * This is equivalent to calling IEventDispatcher::addServiceListener
  112. *
  113. * @psalm-template T of \OCP\EventDispatcher\Event
  114. * @param string $event preferably the fully-qualified class name of the Event sub class to listen for
  115. * @psalm-param string|class-string<T> $event preferably the fully-qualified class name of the Event sub class to listen for
  116. * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
  117. * @psalm-param class-string<\OCP\EventDispatcher\IEventListener> $listener fully qualified class name that can be built by the DI container
  118. * @param int $priority The higher this value, the earlier an event
  119. * listener will be triggered in the chain (defaults to 0)
  120. *
  121. * @see IEventDispatcher::addServiceListener()
  122. *
  123. * @since 20.0.0
  124. */
  125. public function registerEventListener(string $event, string $listener, int $priority = 0): void;
  126. /**
  127. * @param string $class
  128. * @psalm-param class-string<\OCP\AppFramework\Middleware> $class
  129. *
  130. * @return void
  131. * @see IAppContainer::registerMiddleWare()
  132. *
  133. * @since 20.0.0
  134. */
  135. public function registerMiddleware(string $class): void;
  136. /**
  137. * Register a search provider for the unified search
  138. *
  139. * It is allowed to register more than one provider per app as the search
  140. * results can go into distinct sections, e.g. "Files" and "Files shared
  141. * with you" in the Files app.
  142. *
  143. * @param string $class
  144. * @psalm-param class-string<\OCP\Search\IProvider> $class
  145. *
  146. * @return void
  147. *
  148. * @since 20.0.0
  149. */
  150. public function registerSearchProvider(string $class): void;
  151. /**
  152. * Register an alternative login option
  153. *
  154. * It is allowed to register more than one option per app.
  155. *
  156. * @param string $class
  157. * @psalm-param class-string<\OCP\Authentication\IAlternativeLogin> $class
  158. *
  159. * @return void
  160. *
  161. * @since 20.0.0
  162. */
  163. public function registerAlternativeLogin(string $class): void;
  164. /**
  165. * Register an initialstate provider
  166. *
  167. * It is allowed to register more than one provider per app.
  168. *
  169. * @param string $class
  170. * @psalm-param class-string<\OCP\AppFramework\Services\InitialStateProvider> $class
  171. *
  172. * @return void
  173. *
  174. * @since 21.0.0
  175. */
  176. public function registerInitialStateProvider(string $class): void;
  177. /**
  178. * Register a well known protocol handler
  179. *
  180. * It is allowed to register more than one handler per app.
  181. *
  182. * @param string $class
  183. * @psalm-param class-string<\OCP\Http\WellKnown\IHandler> $class
  184. *
  185. * @return void
  186. *
  187. * @since 21.0.0
  188. */
  189. public function registerWellKnownHandler(string $class): void;
  190. /**
  191. * Register a custom template provider class that is able to inject custom templates
  192. * in addition to the user defined ones
  193. *
  194. * @param string $providerClass
  195. * @psalm-param class-string<ICustomTemplateProvider> $providerClass
  196. * @since 21.0.0
  197. */
  198. public function registerTemplateProvider(string $providerClass): void;
  199. /**
  200. * Register an INotifier class
  201. *
  202. * @param string $notifierClass
  203. * @psalm-param class-string<INotifier> $notifierClass
  204. * @since 22.0.0
  205. */
  206. public function registerNotifierService(string $notifierClass): void;
  207. /**
  208. * Register a two-factor provider
  209. *
  210. * @param string $twoFactorProviderClass
  211. * @psalm-param class-string<IProvider> $twoFactorProviderClass
  212. * @since 22.0.0
  213. */
  214. public function registerTwoFactorProvider(string $twoFactorProviderClass): void;
  215. /**
  216. * Register a preview provider
  217. *
  218. * It is allowed to register more than one provider per app.
  219. *
  220. * @param string $previewProviderClass
  221. * @param string $mimeTypeRegex
  222. * @psalm-param class-string<IProviderV2> $previewProviderClass
  223. * @since 23.0.0
  224. */
  225. public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void;
  226. /**
  227. * Register a calendar provider
  228. *
  229. * @param string $class
  230. * @psalm-param class-string<ICalendarProvider> $class
  231. * @since 23.0.0
  232. */
  233. public function registerCalendarProvider(string $class): void;
  234. /**
  235. * Register an implementation of \OCP\Profile\ILinkAction that
  236. * will handle the implementation of a profile link action
  237. *
  238. * @param string $actionClass
  239. * @psalm-param class-string<\OCP\Profile\ILinkAction> $actionClass
  240. * @return void
  241. * @since 23.0.0
  242. */
  243. public function registerProfileLinkAction(string $actionClass): void;
  244. /**
  245. * Register the backend of the Talk app
  246. *
  247. * This service must only be used by the Talk app
  248. *
  249. * @param string $backend
  250. * @return void
  251. * @since 24.0.0
  252. */
  253. public function registerTalkBackend(string $backend): void;
  254. /**
  255. * Register a resource backend for the DAV server
  256. *
  257. * @param string $actionClass
  258. * @psalm-param class-string<\OCP\Calendar\Resource\IBackend> $actionClass
  259. * @return void
  260. * @since 24.0.0
  261. */
  262. public function registerCalendarResourceBackend(string $class): void;
  263. /**
  264. * Register a room backend for the DAV server
  265. *
  266. * @param string $actionClass
  267. * @psalm-param class-string<\OCP\Calendar\Room\IBackend> $actionClass
  268. * @return void
  269. * @since 24.0.0
  270. */
  271. public function registerCalendarRoomBackend(string $class): void;
  272. /**
  273. * Register an implementation of \OCP\UserMigration\IMigrator that
  274. * will handle the implementation of a migrator
  275. *
  276. * @param string $migratorClass
  277. * @psalm-param class-string<\OCP\UserMigration\IMigrator> $migratorClass
  278. * @return void
  279. * @since 24.0.0
  280. */
  281. public function registerUserMigrator(string $migratorClass): void;
  282. /**
  283. * Announce methods of classes that may contain sensitive values, which
  284. * should be obfuscated before being logged.
  285. *
  286. * @param string $class
  287. * @param string[] $methods
  288. * @return void
  289. * @since 25.0.0
  290. */
  291. public function registerSensitiveMethods(string $class, array $methods): void;
  292. }