RegistrationContext.php 21 KB

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