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.7KB

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