Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| Application | n/a |
0 / 0 |
n/a |
0 / 0 |
3 | n/a |
0 / 0 |
|||
| __construct | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| boot | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| register | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\AppInfo; |
| 10 | |
| 11 | use OCA\Files\Event\LoadSidebar; |
| 12 | use OCA\Libresign\Activity\Listener as ActivityListener; |
| 13 | use OCA\Libresign\Capabilities; |
| 14 | use OCA\Libresign\Dashboard\PendingSignaturesWidget; |
| 15 | use OCA\Libresign\Events\SendSignNotificationEvent; |
| 16 | use OCA\Libresign\Events\SignatureRejectedEvent; |
| 17 | use OCA\Libresign\Events\SignedEvent; |
| 18 | use OCA\Libresign\Events\SignRequestCanceledEvent; |
| 19 | use OCA\Libresign\Files\TemplateLoader; |
| 20 | use OCA\Libresign\Listener\BeforeNodeDeletedListener; |
| 21 | use OCA\Libresign\Listener\LoadAdditionalListener; |
| 22 | use OCA\Libresign\Listener\MailNotifyListener; |
| 23 | use OCA\Libresign\Listener\NotificationListener; |
| 24 | use OCA\Libresign\Listener\RevokeClickToSignCertificateListener; |
| 25 | use OCA\Libresign\Listener\SignedCallbackListener; |
| 26 | use OCA\Libresign\Listener\TwofactorGatewayListener; |
| 27 | use OCA\Libresign\Listener\UserDeletedListener; |
| 28 | use OCA\Libresign\Middleware\GlobalInjectionMiddleware; |
| 29 | use OCA\Libresign\Middleware\InjectionMiddleware; |
| 30 | use OCA\Libresign\Notification\Notifier; |
| 31 | use OCA\Libresign\Search\FileSearchProvider; |
| 32 | use OCA\Libresign\Service\Notification\NotificationEventRouter; |
| 33 | use OCA\Libresign\Service\Notification\NotificationModuleCatalog; |
| 34 | use OCP\AppFramework\App; |
| 35 | use OCP\AppFramework\Bootstrap\IBootContext; |
| 36 | use OCP\AppFramework\Bootstrap\IBootstrap; |
| 37 | use OCP\AppFramework\Bootstrap\IRegistrationContext; |
| 38 | use OCP\Files\Cache\CacheEntryRemovedEvent; |
| 39 | use OCP\Files\Events\Node\BeforeNodeDeletedEvent; |
| 40 | use OCP\User\Events\UserDeletedEvent; |
| 41 | use Psr\Container\ContainerInterface; |
| 42 | use Psr\Log\LoggerInterface; |
| 43 | |
| 44 | /** |
| 45 | * @codeCoverageIgnore |
| 46 | */ |
| 47 | class Application extends App implements IBootstrap { |
| 48 | public const APP_ID = 'libresign'; |
| 49 | |
| 50 | public function __construct() { |
| 51 | parent::__construct(self::APP_ID); |
| 52 | } |
| 53 | |
| 54 | #[\Override] |
| 55 | public function boot(IBootContext $context): void { |
| 56 | } |
| 57 | |
| 58 | #[\Override] |
| 59 | public function register(IRegistrationContext $context): void { |
| 60 | $context->registerMiddleWare(GlobalInjectionMiddleware::class, true); |
| 61 | $context->registerMiddleWare(InjectionMiddleware::class); |
| 62 | $context->registerCapability(Capabilities::class); |
| 63 | |
| 64 | $context->registerNotifierService(Notifier::class); |
| 65 | |
| 66 | $context->registerSearchProvider(FileSearchProvider::class); |
| 67 | $context->registerEventListener(LoadSidebar::class, TemplateLoader::class); |
| 68 | $context->registerEventListener(BeforeNodeDeletedEvent::class, BeforeNodeDeletedListener::class); |
| 69 | $context->registerEventListener(CacheEntryRemovedEvent::class, BeforeNodeDeletedListener::class); |
| 70 | $context->registerEventListener(SignedEvent::class, SignedCallbackListener::class); |
| 71 | |
| 72 | // Files newFile listener |
| 73 | $context->registerEventListener('OCA\\Files\\Event\\LoadAdditionalScriptsEvent', LoadAdditionalListener::class); |
| 74 | |
| 75 | // Activity listeners |
| 76 | $context->registerEventListener(SendSignNotificationEvent::class, ActivityListener::class); |
| 77 | $context->registerEventListener(SignedEvent::class, ActivityListener::class); |
| 78 | $context->registerEventListener(SignRequestCanceledEvent::class, ActivityListener::class); |
| 79 | $context->registerEventListener(SignatureRejectedEvent::class, ActivityListener::class); |
| 80 | |
| 81 | // One dispatcher isolates channel failures. New delivery channels |
| 82 | // register one handler here without changing existing channels. |
| 83 | // Each module declares the business events that it supports. |
| 84 | // Add one module here; do not edit existing channels or the router. |
| 85 | $context->registerService(NotificationModuleCatalog::class, static fn (ContainerInterface $container): NotificationModuleCatalog => new NotificationModuleCatalog([ |
| 86 | $container->get(NotificationListener::class), |
| 87 | $container->get(MailNotifyListener::class), |
| 88 | $container->get(TwofactorGatewayListener::class), |
| 89 | ])); |
| 90 | $context->registerService(NotificationEventRouter::class, static fn (ContainerInterface $container): NotificationEventRouter => NotificationEventRouter::fromModules( |
| 91 | $container->get(NotificationModuleCatalog::class)->all(), |
| 92 | $container->get(LoggerInterface::class), |
| 93 | $container->get(\OCP\IDBConnection::class), |
| 94 | )); |
| 95 | // Certificate revocation is part of the signing lifecycle. Do not |
| 96 | // postpone it until external transports have returned. |
| 97 | $context->registerEventListener(SignedEvent::class, RevokeClickToSignCertificateListener::class); |
| 98 | |
| 99 | $context->registerEventListener(SendSignNotificationEvent::class, NotificationEventRouter::class); |
| 100 | $context->registerEventListener(SignedEvent::class, NotificationEventRouter::class); |
| 101 | $context->registerEventListener(SignRequestCanceledEvent::class, NotificationEventRouter::class); |
| 102 | |
| 103 | $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); |
| 104 | |
| 105 | $context->registerDashboardWidget(PendingSignaturesWidget::class); |
| 106 | |
| 107 | $context->registerSetupCheck(\OCA\Libresign\SetupCheck\JavaSetupCheck::class); |
| 108 | $context->registerSetupCheck(\OCA\Libresign\SetupCheck\JSignPdfSetupCheck::class); |
| 109 | $context->registerSetupCheck(\OCA\Libresign\SetupCheck\PDFtkSetupCheck::class); |
| 110 | |
| 111 | $context->registerSetupCheck(\OCA\Libresign\SetupCheck\PopplerSetupCheck::class); |
| 112 | $context->registerSetupCheck(\OCA\Libresign\SetupCheck\ImagickSetupCheck::class); |
| 113 | |
| 114 | $context->registerSetupCheck(\OCA\Libresign\SetupCheck\CertificateEngineSetupCheck::class); |
| 115 | } |
| 116 | } |