RegistrationContext.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  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 OC\AppFramework\Bootstrap;
  28. use Closure;
  29. use OCP\Calendar\Resource\IBackend as IResourceBackend;
  30. use OCP\Calendar\Room\IBackend as IRoomBackend;
  31. use OCP\Collaboration\Reference\IReferenceProvider;
  32. use OCP\SpeechToText\ISpeechToTextProvider;
  33. use OCP\Talk\ITalkBackend;
  34. use OCP\Translation\ITranslationProvider;
  35. use RuntimeException;
  36. use function array_shift;
  37. use OC\Support\CrashReport\Registry;
  38. use OCP\AppFramework\App;
  39. use OCP\AppFramework\Bootstrap\IRegistrationContext;
  40. use OCP\AppFramework\Middleware;
  41. use OCP\AppFramework\Services\InitialStateProvider;
  42. use OCP\Authentication\IAlternativeLogin;
  43. use OCP\Calendar\ICalendarProvider;
  44. use OCP\Capabilities\ICapability;
  45. use OCP\Dashboard\IManager;
  46. use OCP\Dashboard\IWidget;
  47. use OCP\EventDispatcher\IEventDispatcher;
  48. use OCP\Files\Template\ICustomTemplateProvider;
  49. use OCP\Http\WellKnown\IHandler;
  50. use OCP\Notification\INotifier;
  51. use OCP\Profile\ILinkAction;
  52. use OCP\Search\IProvider;
  53. use OCP\Share\IPublicShareTemplateProvider;
  54. use OCP\Support\CrashReport\IReporter;
  55. use OCP\UserMigration\IMigrator as IUserMigrator;
  56. use Psr\Log\LoggerInterface;
  57. use Throwable;
  58. class RegistrationContext {
  59. /** @var ServiceRegistration<ICapability>[] */
  60. private $capabilities = [];
  61. /** @var ServiceRegistration<IReporter>[] */
  62. private $crashReporters = [];
  63. /** @var ServiceRegistration<IWidget>[] */
  64. private $dashboardPanels = [];
  65. /** @var ServiceRegistration<ILinkAction>[] */
  66. private $profileLinkActions = [];
  67. /** @var null|ServiceRegistration<ITalkBackend> */
  68. private $talkBackendRegistration = null;
  69. /** @var ServiceRegistration<IResourceBackend>[] */
  70. private $calendarResourceBackendRegistrations = [];
  71. /** @var ServiceRegistration<IRoomBackend>[] */
  72. private $calendarRoomBackendRegistrations = [];
  73. /** @var ServiceRegistration<IUserMigrator>[] */
  74. private $userMigrators = [];
  75. /** @var ServiceFactoryRegistration[] */
  76. private $services = [];
  77. /** @var ServiceAliasRegistration[] */
  78. private $aliases = [];
  79. /** @var ParameterRegistration[] */
  80. private $parameters = [];
  81. /** @var EventListenerRegistration[] */
  82. private $eventListeners = [];
  83. /** @var MiddlewareRegistration[] */
  84. private $middlewares = [];
  85. /** @var ServiceRegistration<IProvider>[] */
  86. private $searchProviders = [];
  87. /** @var ServiceRegistration<IAlternativeLogin>[] */
  88. private $alternativeLogins = [];
  89. /** @var ServiceRegistration<InitialStateProvider>[] */
  90. private $initialStates = [];
  91. /** @var ServiceRegistration<IHandler>[] */
  92. private $wellKnownHandlers = [];
  93. /** @var ServiceRegistration<ISpeechToTextProvider>[] */
  94. private $speechToTextProviders = [];
  95. /** @var ServiceRegistration<ICustomTemplateProvider>[] */
  96. private $templateProviders = [];
  97. /** @var ServiceRegistration<ITranslationProvider>[] */
  98. private $translationProviders = [];
  99. /** @var ServiceRegistration<INotifier>[] */
  100. private $notifierServices = [];
  101. /** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */
  102. private $twoFactorProviders = [];
  103. /** @var ServiceRegistration<ICalendarProvider>[] */
  104. private $calendarProviders = [];
  105. /** @var ServiceRegistration<IReferenceProvider>[] */
  106. private array $referenceProviders = [];
  107. /** @var ParameterRegistration[] */
  108. private $sensitiveMethods = [];
  109. /** @var ServiceRegistration<IPublicShareTemplateProvider>[] */
  110. private $publicShareTemplateProviders = [];
  111. /** @var LoggerInterface */
  112. private $logger;
  113. /** @var PreviewProviderRegistration[] */
  114. private $previewProviders = [];
  115. public function __construct(LoggerInterface $logger) {
  116. $this->logger = $logger;
  117. }
  118. public function for(string $appId): IRegistrationContext {
  119. return new class($appId, $this) implements IRegistrationContext {
  120. /** @var string */
  121. private $appId;
  122. /** @var RegistrationContext */
  123. private $context;
  124. public function __construct(string $appId, RegistrationContext $context) {
  125. $this->appId = $appId;
  126. $this->context = $context;
  127. }
  128. public function registerCapability(string $capability): void {
  129. $this->context->registerCapability(
  130. $this->appId,
  131. $capability
  132. );
  133. }
  134. public function registerCrashReporter(string $reporterClass): void {
  135. $this->context->registerCrashReporter(
  136. $this->appId,
  137. $reporterClass
  138. );
  139. }
  140. public function registerDashboardWidget(string $widgetClass): void {
  141. $this->context->registerDashboardPanel(
  142. $this->appId,
  143. $widgetClass
  144. );
  145. }
  146. public function registerService(string $name, callable $factory, bool $shared = true): void {
  147. $this->context->registerService(
  148. $this->appId,
  149. $name,
  150. $factory,
  151. $shared
  152. );
  153. }
  154. public function registerServiceAlias(string $alias, string $target): void {
  155. $this->context->registerServiceAlias(
  156. $this->appId,
  157. $alias,
  158. $target
  159. );
  160. }
  161. public function registerParameter(string $name, $value): void {
  162. $this->context->registerParameter(
  163. $this->appId,
  164. $name,
  165. $value
  166. );
  167. }
  168. public function registerEventListener(string $event, string $listener, int $priority = 0): void {
  169. $this->context->registerEventListener(
  170. $this->appId,
  171. $event,
  172. $listener,
  173. $priority
  174. );
  175. }
  176. public function registerMiddleware(string $class, bool $global = false): void {
  177. $this->context->registerMiddleware(
  178. $this->appId,
  179. $class,
  180. $global,
  181. );
  182. }
  183. public function registerSearchProvider(string $class): void {
  184. $this->context->registerSearchProvider(
  185. $this->appId,
  186. $class
  187. );
  188. }
  189. public function registerAlternativeLogin(string $class): void {
  190. $this->context->registerAlternativeLogin(
  191. $this->appId,
  192. $class
  193. );
  194. }
  195. public function registerInitialStateProvider(string $class): void {
  196. $this->context->registerInitialState(
  197. $this->appId,
  198. $class
  199. );
  200. }
  201. public function registerWellKnownHandler(string $class): void {
  202. $this->context->registerWellKnown(
  203. $this->appId,
  204. $class
  205. );
  206. }
  207. public function registerSpeechToTextProvider(string $providerClass): void {
  208. $this->context->registerSpeechToTextProvider(
  209. $this->appId,
  210. $providerClass
  211. );
  212. }
  213. public function registerTemplateProvider(string $providerClass): void {
  214. $this->context->registerTemplateProvider(
  215. $this->appId,
  216. $providerClass
  217. );
  218. }
  219. public function registerTranslationProvider(string $providerClass): void {
  220. $this->context->registerTranslationProvider(
  221. $this->appId,
  222. $providerClass
  223. );
  224. }
  225. public function registerNotifierService(string $notifierClass): void {
  226. $this->context->registerNotifierService(
  227. $this->appId,
  228. $notifierClass
  229. );
  230. }
  231. public function registerTwoFactorProvider(string $twoFactorProviderClass): void {
  232. $this->context->registerTwoFactorProvider(
  233. $this->appId,
  234. $twoFactorProviderClass
  235. );
  236. }
  237. public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void {
  238. $this->context->registerPreviewProvider(
  239. $this->appId,
  240. $previewProviderClass,
  241. $mimeTypeRegex
  242. );
  243. }
  244. public function registerCalendarProvider(string $class): void {
  245. $this->context->registerCalendarProvider(
  246. $this->appId,
  247. $class
  248. );
  249. }
  250. public function registerReferenceProvider(string $class): void {
  251. $this->context->registerReferenceProvider(
  252. $this->appId,
  253. $class
  254. );
  255. }
  256. public function registerProfileLinkAction(string $actionClass): void {
  257. $this->context->registerProfileLinkAction(
  258. $this->appId,
  259. $actionClass
  260. );
  261. }
  262. public function registerTalkBackend(string $backend): void {
  263. $this->context->registerTalkBackend(
  264. $this->appId,
  265. $backend
  266. );
  267. }
  268. public function registerCalendarResourceBackend(string $class): void {
  269. $this->context->registerCalendarResourceBackend(
  270. $this->appId,
  271. $class
  272. );
  273. }
  274. public function registerCalendarRoomBackend(string $class): void {
  275. $this->context->registerCalendarRoomBackend(
  276. $this->appId,
  277. $class
  278. );
  279. }
  280. public function registerUserMigrator(string $migratorClass): void {
  281. $this->context->registerUserMigrator(
  282. $this->appId,
  283. $migratorClass
  284. );
  285. }
  286. public function registerSensitiveMethods(string $class, array $methods): void {
  287. $this->context->registerSensitiveMethods(
  288. $this->appId,
  289. $class,
  290. $methods
  291. );
  292. }
  293. public function registerPublicShareTemplateProvider(string $class): void {
  294. $this->context->registerPublicShareTemplateProvider(
  295. $this->appId,
  296. $class
  297. );
  298. }
  299. };
  300. }
  301. /**
  302. * @psalm-param class-string<ICapability> $capability
  303. */
  304. public function registerCapability(string $appId, string $capability): void {
  305. $this->capabilities[] = new ServiceRegistration($appId, $capability);
  306. }
  307. /**
  308. * @psalm-param class-string<IReporter> $capability
  309. */
  310. public function registerCrashReporter(string $appId, string $reporterClass): void {
  311. $this->crashReporters[] = new ServiceRegistration($appId, $reporterClass);
  312. }
  313. /**
  314. * @psalm-param class-string<IWidget> $capability
  315. */
  316. public function registerDashboardPanel(string $appId, string $panelClass): void {
  317. $this->dashboardPanels[] = new ServiceRegistration($appId, $panelClass);
  318. }
  319. public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void {
  320. $this->services[] = new ServiceFactoryRegistration($appId, $name, $factory, $shared);
  321. }
  322. public function registerServiceAlias(string $appId, string $alias, string $target): void {
  323. $this->aliases[] = new ServiceAliasRegistration($appId, $alias, $target);
  324. }
  325. public function registerParameter(string $appId, string $name, $value): void {
  326. $this->parameters[] = new ParameterRegistration($appId, $name, $value);
  327. }
  328. public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void {
  329. $this->eventListeners[] = new EventListenerRegistration($appId, $event, $listener, $priority);
  330. }
  331. /**
  332. * @psalm-param class-string<Middleware> $class
  333. */
  334. public function registerMiddleware(string $appId, string $class, bool $global): void {
  335. $this->middlewares[] = new MiddlewareRegistration($appId, $class, $global);
  336. }
  337. public function registerSearchProvider(string $appId, string $class) {
  338. $this->searchProviders[] = new ServiceRegistration($appId, $class);
  339. }
  340. public function registerAlternativeLogin(string $appId, string $class): void {
  341. $this->alternativeLogins[] = new ServiceRegistration($appId, $class);
  342. }
  343. public function registerInitialState(string $appId, string $class): void {
  344. $this->initialStates[] = new ServiceRegistration($appId, $class);
  345. }
  346. public function registerWellKnown(string $appId, string $class): void {
  347. $this->wellKnownHandlers[] = new ServiceRegistration($appId, $class);
  348. }
  349. public function registerSpeechToTextProvider(string $appId, string $class): void {
  350. $this->speechToTextProviders[] = new ServiceRegistration($appId, $class);
  351. }
  352. public function registerTemplateProvider(string $appId, string $class): void {
  353. $this->templateProviders[] = new ServiceRegistration($appId, $class);
  354. }
  355. public function registerTranslationProvider(string $appId, string $class): void {
  356. $this->translationProviders[] = new ServiceRegistration($appId, $class);
  357. }
  358. public function registerNotifierService(string $appId, string $class): void {
  359. $this->notifierServices[] = new ServiceRegistration($appId, $class);
  360. }
  361. public function registerTwoFactorProvider(string $appId, string $class): void {
  362. $this->twoFactorProviders[] = new ServiceRegistration($appId, $class);
  363. }
  364. public function registerPreviewProvider(string $appId, string $class, string $mimeTypeRegex): void {
  365. $this->previewProviders[] = new PreviewProviderRegistration($appId, $class, $mimeTypeRegex);
  366. }
  367. public function registerCalendarProvider(string $appId, string $class): void {
  368. $this->calendarProviders[] = new ServiceRegistration($appId, $class);
  369. }
  370. public function registerReferenceProvider(string $appId, string $class): void {
  371. $this->referenceProviders[] = new ServiceRegistration($appId, $class);
  372. }
  373. /**
  374. * @psalm-param class-string<ILinkAction> $actionClass
  375. */
  376. public function registerProfileLinkAction(string $appId, string $actionClass): void {
  377. $this->profileLinkActions[] = new ServiceRegistration($appId, $actionClass);
  378. }
  379. /**
  380. * @psalm-param class-string<ITalkBackend> $backend
  381. */
  382. public function registerTalkBackend(string $appId, string $backend) {
  383. // Some safeguards for invalid registrations
  384. if ($appId !== 'spreed') {
  385. throw new RuntimeException("Only the Talk app is allowed to register a Talk backend");
  386. }
  387. if ($this->talkBackendRegistration !== null) {
  388. throw new RuntimeException("There can only be one Talk backend");
  389. }
  390. $this->talkBackendRegistration = new ServiceRegistration($appId, $backend);
  391. }
  392. public function registerCalendarResourceBackend(string $appId, string $class) {
  393. $this->calendarResourceBackendRegistrations[] = new ServiceRegistration(
  394. $appId,
  395. $class,
  396. );
  397. }
  398. public function registerCalendarRoomBackend(string $appId, string $class) {
  399. $this->calendarRoomBackendRegistrations[] = new ServiceRegistration(
  400. $appId,
  401. $class,
  402. );
  403. }
  404. /**
  405. * @psalm-param class-string<IUserMigrator> $migratorClass
  406. */
  407. public function registerUserMigrator(string $appId, string $migratorClass): void {
  408. $this->userMigrators[] = new ServiceRegistration($appId, $migratorClass);
  409. }
  410. public function registerSensitiveMethods(string $appId, string $class, array $methods): void {
  411. $methods = array_filter($methods, 'is_string');
  412. $this->sensitiveMethods[] = new ParameterRegistration($appId, $class, $methods);
  413. }
  414. public function registerPublicShareTemplateProvider(string $appId, string $class): void {
  415. $this->publicShareTemplateProviders[] = new ServiceRegistration($appId, $class);
  416. }
  417. /**
  418. * @param App[] $apps
  419. */
  420. public function delegateCapabilityRegistrations(array $apps): void {
  421. while (($registration = array_shift($this->capabilities)) !== null) {
  422. $appId = $registration->getAppId();
  423. if (!isset($apps[$appId])) {
  424. // If we land here something really isn't right. But at least we caught the
  425. // notice that is otherwise emitted for the undefined index
  426. $this->logger->error("App $appId not loaded for the capability registration");
  427. continue;
  428. }
  429. try {
  430. $apps[$appId]
  431. ->getContainer()
  432. ->registerCapability($registration->getService());
  433. } catch (Throwable $e) {
  434. $this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [
  435. 'exception' => $e,
  436. ]);
  437. }
  438. }
  439. }
  440. /**
  441. * @param App[] $apps
  442. */
  443. public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void {
  444. while (($registration = array_shift($this->crashReporters)) !== null) {
  445. try {
  446. $registry->registerLazy($registration->getService());
  447. } catch (Throwable $e) {
  448. $appId = $registration->getAppId();
  449. $this->logger->error("Error during crash reporter registration of $appId: " . $e->getMessage(), [
  450. 'exception' => $e,
  451. ]);
  452. }
  453. }
  454. }
  455. /**
  456. * @param App[] $apps
  457. */
  458. public function delegateDashboardPanelRegistrations(IManager $dashboardManager): void {
  459. while (($panel = array_shift($this->dashboardPanels)) !== null) {
  460. try {
  461. $dashboardManager->lazyRegisterWidget($panel->getService(), $panel->getAppId());
  462. } catch (Throwable $e) {
  463. $appId = $panel->getAppId();
  464. $this->logger->error("Error during dashboard registration of $appId: " . $e->getMessage(), [
  465. 'exception' => $e,
  466. ]);
  467. }
  468. }
  469. }
  470. public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void {
  471. while (($registration = array_shift($this->eventListeners)) !== null) {
  472. try {
  473. $eventDispatcher->addServiceListener(
  474. $registration->getEvent(),
  475. $registration->getService(),
  476. $registration->getPriority()
  477. );
  478. } catch (Throwable $e) {
  479. $appId = $registration->getAppId();
  480. $this->logger->error("Error during event listener registration of $appId: " . $e->getMessage(), [
  481. 'exception' => $e,
  482. ]);
  483. }
  484. }
  485. }
  486. /**
  487. * @param App[] $apps
  488. */
  489. public function delegateContainerRegistrations(array $apps): void {
  490. while (($registration = array_shift($this->services)) !== null) {
  491. $appId = $registration->getAppId();
  492. if (!isset($apps[$appId])) {
  493. // If we land here something really isn't right. But at least we caught the
  494. // notice that is otherwise emitted for the undefined index
  495. $this->logger->error("App $appId not loaded for the container service registration");
  496. continue;
  497. }
  498. try {
  499. /**
  500. * Register the service and convert the callable into a \Closure if necessary
  501. */
  502. $apps[$appId]
  503. ->getContainer()
  504. ->registerService(
  505. $registration->getName(),
  506. Closure::fromCallable($registration->getFactory()),
  507. $registration->isShared()
  508. );
  509. } catch (Throwable $e) {
  510. $this->logger->error("Error during service registration of $appId: " . $e->getMessage(), [
  511. 'exception' => $e,
  512. ]);
  513. }
  514. }
  515. while (($registration = array_shift($this->aliases)) !== null) {
  516. $appId = $registration->getAppId();
  517. if (!isset($apps[$appId])) {
  518. // If we land here something really isn't right. But at least we caught the
  519. // notice that is otherwise emitted for the undefined index
  520. $this->logger->error("App $appId not loaded for the container alias registration");
  521. continue;
  522. }
  523. try {
  524. $apps[$appId]
  525. ->getContainer()
  526. ->registerAlias(
  527. $registration->getAlias(),
  528. $registration->getTarget()
  529. );
  530. } catch (Throwable $e) {
  531. $this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [
  532. 'exception' => $e,
  533. ]);
  534. }
  535. }
  536. while (($registration = array_shift($this->parameters)) !== null) {
  537. $appId = $registration->getAppId();
  538. if (!isset($apps[$appId])) {
  539. // If we land here something really isn't right. But at least we caught the
  540. // notice that is otherwise emitted for the undefined index
  541. $this->logger->error("App $appId not loaded for the container parameter registration");
  542. continue;
  543. }
  544. try {
  545. $apps[$appId]
  546. ->getContainer()
  547. ->registerParameter(
  548. $registration->getName(),
  549. $registration->getValue()
  550. );
  551. } catch (Throwable $e) {
  552. $this->logger->error("Error during service parameter registration of $appId: " . $e->getMessage(), [
  553. 'exception' => $e,
  554. ]);
  555. }
  556. }
  557. }
  558. /**
  559. * @return MiddlewareRegistration[]
  560. */
  561. public function getMiddlewareRegistrations(): array {
  562. return $this->middlewares;
  563. }
  564. /**
  565. * @return ServiceRegistration<IProvider>[]
  566. */
  567. public function getSearchProviders(): array {
  568. return $this->searchProviders;
  569. }
  570. /**
  571. * @return ServiceRegistration<IAlternativeLogin>[]
  572. */
  573. public function getAlternativeLogins(): array {
  574. return $this->alternativeLogins;
  575. }
  576. /**
  577. * @return ServiceRegistration<InitialStateProvider>[]
  578. */
  579. public function getInitialStates(): array {
  580. return $this->initialStates;
  581. }
  582. /**
  583. * @return ServiceRegistration<IHandler>[]
  584. */
  585. public function getWellKnownHandlers(): array {
  586. return $this->wellKnownHandlers;
  587. }
  588. /**
  589. * @return ServiceRegistration<ISpeechToTextProvider>[]
  590. */
  591. public function getSpeechToTextProviders(): array {
  592. return $this->speechToTextProviders;
  593. }
  594. /**
  595. * @return ServiceRegistration<ICustomTemplateProvider>[]
  596. */
  597. public function getTemplateProviders(): array {
  598. return $this->templateProviders;
  599. }
  600. /**
  601. * @return ServiceRegistration<ITranslationProvider>[]
  602. */
  603. public function getTranslationProviders(): array {
  604. return $this->translationProviders;
  605. }
  606. /**
  607. * @return ServiceRegistration<INotifier>[]
  608. */
  609. public function getNotifierServices(): array {
  610. return $this->notifierServices;
  611. }
  612. /**
  613. * @return ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[]
  614. */
  615. public function getTwoFactorProviders(): array {
  616. return $this->twoFactorProviders;
  617. }
  618. /**
  619. * @return PreviewProviderRegistration[]
  620. */
  621. public function getPreviewProviders(): array {
  622. return $this->previewProviders;
  623. }
  624. /**
  625. * @return ServiceRegistration<ICalendarProvider>[]
  626. */
  627. public function getCalendarProviders(): array {
  628. return $this->calendarProviders;
  629. }
  630. /**
  631. * @return ServiceRegistration<IReferenceProvider>[]
  632. */
  633. public function getReferenceProviders(): array {
  634. return $this->referenceProviders;
  635. }
  636. /**
  637. * @return ServiceRegistration<ILinkAction>[]
  638. */
  639. public function getProfileLinkActions(): array {
  640. return $this->profileLinkActions;
  641. }
  642. /**
  643. * @return ServiceRegistration|null
  644. * @psalm-return ServiceRegistration<ITalkBackend>|null
  645. */
  646. public function getTalkBackendRegistration(): ?ServiceRegistration {
  647. return $this->talkBackendRegistration;
  648. }
  649. /**
  650. * @return ServiceRegistration[]
  651. * @psalm-return ServiceRegistration<IResourceBackend>[]
  652. */
  653. public function getCalendarResourceBackendRegistrations(): array {
  654. return $this->calendarResourceBackendRegistrations;
  655. }
  656. /**
  657. * @return ServiceRegistration[]
  658. * @psalm-return ServiceRegistration<IRoomBackend>[]
  659. */
  660. public function getCalendarRoomBackendRegistrations(): array {
  661. return $this->calendarRoomBackendRegistrations;
  662. }
  663. /**
  664. * @return ServiceRegistration<IUserMigrator>[]
  665. */
  666. public function getUserMigrators(): array {
  667. return $this->userMigrators;
  668. }
  669. /**
  670. * @return ParameterRegistration[]
  671. */
  672. public function getSensitiveMethods(): array {
  673. return $this->sensitiveMethods;
  674. }
  675. /**
  676. * @return ServiceRegistration<IPublicShareTemplateProvider>[]
  677. */
  678. public function getPublicShareTemplateProviders(): array {
  679. return $this->publicShareTemplateProviders;
  680. }
  681. }