From 4f5a394706041918214cd39c90eb43122484fb56 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 7 Jul 2023 10:47:15 +0200 Subject: [PATCH 1/6] SUPP0RT-1135: Added digital post id filter to command --- src/Command/DigitalPostEnvelopeListCommand.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Command/DigitalPostEnvelopeListCommand.php b/src/Command/DigitalPostEnvelopeListCommand.php index 600183ef..e41dd8a9 100644 --- a/src/Command/DigitalPostEnvelopeListCommand.php +++ b/src/Command/DigitalPostEnvelopeListCommand.php @@ -37,7 +37,8 @@ protected function configure() { $this ->addOption('status', null, InputOption::VALUE_REQUIRED, 'Show only envelopes with this status') - ->addOption('digital-post-subject', null, InputOption::VALUE_REQUIRED, 'Show only envelopes with subject matching this LIKE expression') + ->addOption('digital-post-id', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Show only envelopes with the digital post id') + ->addOption('digital-post-subject', null, InputOption::VALUE_REQUIRED, 'Show only envelopes with digital post subjects matching this LIKE expression') ->addOption('max-results', null, InputOption::VALUE_REQUIRED, 'Show at most this many envelopes', 10) ->addOption('id', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Envelope id') ->addOption('message-uuid', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Messaged uuid') @@ -134,6 +135,14 @@ private function findEnvelopes(InputInterface $input): array ->setParameter('status', $status) ; } + if ($ids = $input->getOption('digital-post-id')) { + $ids = array_map(static fn (string $id) => Uuid::fromString($id)->toBinary(), $ids); + $qb + ->join('e.digitalPost', 'p') + ->andWhere('p.id IN (:digital_post_ids)') + ->setParameter('digital_post_ids', $ids) + ; + } if ($subject = $input->getOption('digital-post-subject')) { $qb ->join('e.digitalPost', 'p') From c928646c9f2273eddfa33e14a0f67fd9ef066ba2 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 7 Jul 2023 10:47:52 +0200 Subject: [PATCH 2/6] SUPP0RT-1135: Hacked up a digital post debug command --- src/Command/DigitalPostDebugCommand.php | 56 +++++++++++++++++++++++++ src/Service/SF1601/DigitalPoster.php | 29 +++++++------ 2 files changed, 72 insertions(+), 13 deletions(-) create mode 100644 src/Command/DigitalPostDebugCommand.php diff --git a/src/Command/DigitalPostDebugCommand.php b/src/Command/DigitalPostDebugCommand.php new file mode 100644 index 00000000..17d73bf3 --- /dev/null +++ b/src/Command/DigitalPostDebugCommand.php @@ -0,0 +1,56 @@ +addArgument('action', InputArgument::REQUIRED, 'The action'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $action = $input->getArgument('action'); + + switch ($action) { + case 'getSAMLToken': + case 'fetchSAMLToken': + $sf1601 = $this->invoke($this->digitalPoster, 'getSF1601'); + $entityId = 'http://entityid.kombit.dk/service/kombipostafsend/1'; + $samlToken = $this->invoke($sf1601, $action, [$entityId]); + + $output->write(json_encode($samlToken)); + + return Command::SUCCESS; + } + } + + /** + * Invoke method on an object. + */ + private function invoke(object $object, string $method, array $args = []): mixed + { + $method = new \ReflectionMethod($object, $method); + $method->setAccessible(true); + + return $method->invoke($object, ...$args); + } +} diff --git a/src/Service/SF1601/DigitalPoster.php b/src/Service/SF1601/DigitalPoster.php index d1b0c974..36a49b3b 100644 --- a/src/Service/SF1601/DigitalPoster.php +++ b/src/Service/SF1601/DigitalPoster.php @@ -27,13 +27,7 @@ public function __construct(private CertificateLocatorHelper $certificateLocator public function canReceive(string $type, string $identifier): ?bool { - $options = $this->options['sf1601'] - + [ - 'certificate_locator' => $this->certificateLocatorHelper->getCertificateLocator(), - ]; - unset($options[ForsendelseHelper::FORSENDELSES_TYPE_IDENTIFIKATOR]); - $service = new SF1601($options); - + $service = $this->getSF1601(); $transactionId = Serializer::createUuid(); return $service->postForespoerg($transactionId, $type, $identifier); @@ -80,12 +74,7 @@ public function sendDigitalPost(DigitalPost $digitalPost, DigitalPost\Recipient ]; $forsendelse = $this->forsendelseHelper->createForsendelse($digitalPost, $recipient, $forsendelseOptions); - $options = $this->options['sf1601'] - + [ - 'certificate_locator' => $this->certificateLocatorHelper->getCertificateLocator(), - ]; - unset($options[ForsendelseHelper::FORSENDELSES_TYPE_IDENTIFIKATOR]); - $service = new SF1601($options); + $service = $this->getSF1601(); $transactionId = Serializer::createUuid(); $response = $service->kombiPostAfsend($transactionId, SF1601::TYPE_AUTOMATISK_VALG, $meMoMessage, $forsendelse); @@ -154,6 +143,20 @@ public function sendDigitalPost(DigitalPost $digitalPost, DigitalPost\Recipient } } + /** + * Get SF1601 instance. + */ + private function getSF1601(): SF1601 + { + $options = $this->options['sf1601'] + + [ + 'certificate_locator' => $this->certificateLocatorHelper->getCertificateLocator(), + ]; + unset($options[ForsendelseHelper::FORSENDELSES_TYPE_IDENTIFIKATOR]); + + return new SF1601($options); + } + private function resolveOptions(array $options): array { return (new OptionsResolver()) From fd888064dc09fe4c392feb48878f87534851db0b Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 7 Jul 2023 11:09:53 +0200 Subject: [PATCH 3/6] SUPP0RT-1135: Updated change log --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8c64384..6cf5f844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ about writing changes to this log. ## [Unreleased] +- [PR-377](https://github.com/itk-dev/naevnssekretariatet/pull/377) + Improved `tvist1:digital-post-envelope:list` command and added Digital post + debug command. + ## [1.5.1] - [PR-375](https://github.com/itk-dev/naevnssekretariatet/pull/375) From ccf30eaa5d269878c4a0eff8cfa7c11527bf9804 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 7 Jul 2023 11:43:01 +0200 Subject: [PATCH 4/6] SUPP0RT-1135: Locked PHP fpm image --- docker-compose.server.override.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.server.override.yml b/docker-compose.server.override.yml index 8e0a9318..552344b2 100644 --- a/docker-compose.server.override.yml +++ b/docker-compose.server.override.yml @@ -1,5 +1,6 @@ services: phpfpm: + image: itkdev/php8.1-fpm:alpine-1.1.25 environment: - PHP_MAX_EXECUTION_TIME=60 - PHP_MEMORY_LIMIT=512M From 2b6223c6817e7b59906a86c7d9691a47cd984983 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 7 Jul 2023 12:10:54 +0200 Subject: [PATCH 5/6] SUPP0RT-1135: Updated (sort of) Serviceplatformen library --- composer.json | 2 +- composer.lock | 14 +++++++------- docker-compose.server.override.yml | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 32aee845..d688dde6 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "itk-dev/beskedfordeler-symfony": "^1.0", "itk-dev/datafordeler-php-client": "dev-develop", "itk-dev/openid-connect-bundle": "dev-develop", - "itk-dev/serviceplatformen": "dev-feature/guzzle7-adapter", + "itk-dev/serviceplatformen": "dev-feature/tvist1", "knplabs/knp-paginator-bundle": "^5.6", "league/oauth2-client": "^2.6", "lexik/form-filter-bundle": "^7.0", diff --git a/composer.lock b/composer.lock index d25ff7dc..4e94f753 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "72ac2843bb623840a7f9d0d5f7322aea", + "content-hash": "baa7e6fe13812b5903615ff7b280ccb9", "packages": [ { "name": "behat/transliterator", @@ -2704,16 +2704,16 @@ }, { "name": "itk-dev/serviceplatformen", - "version": "dev-feature/guzzle7-adapter", + "version": "dev-feature/tvist1", "source": { "type": "git", "url": "https://github.com/itk-dev/serviceplatformen.git", - "reference": "6fba39bed5eb60efd5169633520d128fdabcc557" + "reference": "64b46ba62547217758501a2af29de2230d6e4dae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/itk-dev/serviceplatformen/zipball/6fba39bed5eb60efd5169633520d128fdabcc557", - "reference": "6fba39bed5eb60efd5169633520d128fdabcc557", + "url": "https://api.github.com/repos/itk-dev/serviceplatformen/zipball/64b46ba62547217758501a2af29de2230d6e4dae", + "reference": "64b46ba62547217758501a2af29de2230d6e4dae", "shasum": "" }, "require": { @@ -2786,9 +2786,9 @@ ], "support": { "issues": "https://github.com/itk-dev/serviceplatformen/issues", - "source": "https://github.com/itk-dev/serviceplatformen/tree/feature/guzzle7-adapter" + "source": "https://github.com/itk-dev/serviceplatformen/tree/feature/tvist1" }, - "time": "2023-03-27T11:34:51+00:00" + "time": "2023-07-07T10:00:35+00:00" }, { "name": "jms/metadata", diff --git a/docker-compose.server.override.yml b/docker-compose.server.override.yml index 552344b2..8e0a9318 100644 --- a/docker-compose.server.override.yml +++ b/docker-compose.server.override.yml @@ -1,6 +1,5 @@ services: phpfpm: - image: itkdev/php8.1-fpm:alpine-1.1.25 environment: - PHP_MAX_EXECUTION_TIME=60 - PHP_MEMORY_LIMIT=512M From b6c69d91e0b016ad8183a06b80e0dbef25e2bd67 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 19 Dec 2023 11:45:00 +0100 Subject: [PATCH 6/6] Release 1.5.3 --- CHANGELOG.md | 5 ++++- composer.json | 4 ++-- composer.lock | 31 ++++++++++++++----------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82a26f3c..ef4a692f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ about writing changes to this log. ## [Unreleased] +## [1.5.3] - 2023-12-19 + - [PR-377](https://github.com/itk-dev/naevnssekretariatet/pull/377) Improved `tvist1:digital-post-envelope:list` command and added Digital post debug command. @@ -296,7 +298,8 @@ Fixed error in unescaped characters in filename - [TVIST1-604](https://jira.itkdev.dk/browse/TVIST1-604): Resolved issue regarding time formats. -[Unreleased]: https://github.com/itk-dev/naevnssekretariatet/compare/1.5.2...HEAD +[Unreleased]: https://github.com/itk-dev/naevnssekretariatet/compare/1.5.3...HEAD +[1.5.3]: https://github.com/itk-dev/naevnssekretariatet/compare/1.5.2...1.5.3 [1.5.2]: https://github.com/itk-dev/naevnssekretariatet/compare/1.5.1...1.5.2 [1.5.1]: https://github.com/itk-dev/naevnssekretariatet/compare/1.5.0...1.5.1 [1.5.0]: https://github.com/itk-dev/naevnssekretariatet/compare/1.4.1...1.5.0 diff --git a/composer.json b/composer.json index d688dde6..4a484bd2 100644 --- a/composer.json +++ b/composer.json @@ -35,8 +35,8 @@ "gedmo/doctrine-extensions": "^3.0", "itk-dev/azure-key-vault-php": "^1.0", "itk-dev/beskedfordeler-symfony": "^1.0", - "itk-dev/datafordeler-php-client": "dev-develop", - "itk-dev/openid-connect-bundle": "dev-develop", + "itk-dev/datafordeler-php-client": "^1.0", + "itk-dev/openid-connect-bundle": "^2.0", "itk-dev/serviceplatformen": "dev-feature/tvist1", "knplabs/knp-paginator-bundle": "^5.6", "league/oauth2-client": "^2.6", diff --git a/composer.lock b/composer.lock index 4e94f753..6177edad 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "baa7e6fe13812b5903615ff7b280ccb9", + "content-hash": "67e38e62eefe8ad3301eff80be165aab", "packages": [ { "name": "behat/transliterator", @@ -2521,16 +2521,16 @@ }, { "name": "itk-dev/datafordeler-php-client", - "version": "dev-develop", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/itk-dev/datafordeler-php-client.git", - "reference": "619145e7ebe07a1c59084abfa481f9dd835984c5" + "reference": "7e7d31231320781a421dcc5ff8f36155f175c236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/itk-dev/datafordeler-php-client/zipball/619145e7ebe07a1c59084abfa481f9dd835984c5", - "reference": "619145e7ebe07a1c59084abfa481f9dd835984c5", + "url": "https://api.github.com/repos/itk-dev/datafordeler-php-client/zipball/7e7d31231320781a421dcc5ff8f36155f175c236", + "reference": "7e7d31231320781a421dcc5ff8f36155f175c236", "shasum": "" }, "require": { @@ -2575,10 +2575,10 @@ ], "description": "PHP client for datafordeler.dk", "support": { - "source": "https://github.com/itk-dev/datafordeler-php-client/tree/develop", + "source": "https://github.com/itk-dev/datafordeler-php-client/tree/1.0.0", "issues": "https://github.com/itk-dev/datafordeler-php-client/issues" }, - "time": "2022-02-23T14:44:58+00:00" + "time": "2023-02-18T10:23:46+00:00" }, { "name": "itk-dev/openid-connect", @@ -2644,16 +2644,16 @@ }, { "name": "itk-dev/openid-connect-bundle", - "version": "dev-develop", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/itk-dev/openid-connect-bundle.git", - "reference": "5706f7ee285507952d116c757b9ec2fedd9e15dc" + "reference": "4dc2119ae6d8605eb647b09e80fac3f1ca8c24b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/itk-dev/openid-connect-bundle/zipball/5706f7ee285507952d116c757b9ec2fedd9e15dc", - "reference": "5706f7ee285507952d116c757b9ec2fedd9e15dc", + "url": "https://api.github.com/repos/itk-dev/openid-connect-bundle/zipball/4dc2119ae6d8605eb647b09e80fac3f1ca8c24b8", + "reference": "4dc2119ae6d8605eb647b09e80fac3f1ca8c24b8", "shasum": "" }, "require": { @@ -2674,7 +2674,6 @@ "phpunit/phpunit": "^9.5", "vimeo/psalm": "^4.7" }, - "default-branch": true, "type": "symfony-bundle", "autoload": { "psr-4": { @@ -2698,9 +2697,9 @@ "description": "Symfony bundle for openid-connect", "support": { "issues": "https://github.com/itk-dev/openid-connect-bundle/issues", - "source": "https://github.com/itk-dev/openid-connect-bundle/tree/develop" + "source": "https://github.com/itk-dev/openid-connect-bundle/tree/2.0.0" }, - "time": "2022-01-10T10:54:13+00:00" + "time": "2022-01-10T10:53:42+00:00" }, { "name": "itk-dev/serviceplatformen", @@ -14836,8 +14835,6 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { - "itk-dev/datafordeler-php-client": 20, - "itk-dev/openid-connect-bundle": 20, "itk-dev/serviceplatformen": 20 }, "prefer-stable": true, @@ -14850,5 +14847,5 @@ "ext-soap": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" }