Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
9 / 9 |
CRAP | |
100.00% |
1 / 1 |
| SignedEvent | |
100.00% |
9 / 9 |
|
100.00% |
9 / 9 |
9 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDeliveryEventId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLibreSignFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSignRequest | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getIdentifyMethod | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSignedFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| wasSignedWithoutPassword | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCertificateSerialNumber | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
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\Events; |
| 10 | |
| 11 | use OCA\Libresign\Db\File as FileEntity; |
| 12 | use OCA\Libresign\Db\SignRequest; |
| 13 | use OCA\Libresign\Service\IdentifyMethod\IIdentifyMethod; |
| 14 | use OCP\EventDispatcher\Event; |
| 15 | use OCP\Files\File; |
| 16 | use OCP\IUser; |
| 17 | |
| 18 | class SignedEvent extends Event { |
| 19 | public const FILE_SIGNED = 'libresign_file_signed'; |
| 20 | public function __construct( |
| 21 | private SignRequest $signRequest, |
| 22 | private FileEntity $libreSignFile, |
| 23 | private IIdentifyMethod $identifyMethod, |
| 24 | private IUser $user, |
| 25 | private File $signedFile, |
| 26 | private bool $signedWithoutPassword = false, |
| 27 | private ?string $certificateSerialNumber = null, |
| 28 | ) { |
| 29 | } |
| 30 | |
| 31 | public function getDeliveryEventId(): string { |
| 32 | // Idempotent for a repeat of the same completed signature. |
| 33 | return 'signed:' . $this->signRequest->getUuid() . ':' . ($this->signRequest->getSignedHash() ?? ''); |
| 34 | } |
| 35 | |
| 36 | public function getLibreSignFile(): FileEntity { |
| 37 | return $this->libreSignFile; |
| 38 | } |
| 39 | |
| 40 | public function getSignRequest(): SignRequest { |
| 41 | return $this->signRequest; |
| 42 | } |
| 43 | |
| 44 | public function getIdentifyMethod(): IIdentifyMethod { |
| 45 | return $this->identifyMethod; |
| 46 | } |
| 47 | |
| 48 | public function getUser(): IUser { |
| 49 | return $this->user; |
| 50 | } |
| 51 | |
| 52 | public function getSignedFile(): File { |
| 53 | return $this->signedFile; |
| 54 | } |
| 55 | |
| 56 | public function wasSignedWithoutPassword(): bool { |
| 57 | return $this->signedWithoutPassword; |
| 58 | } |
| 59 | |
| 60 | public function getCertificateSerialNumber(): ?string { |
| 61 | return $this->certificateSerialNumber; |
| 62 | } |
| 63 | } |