Skip to content

Commit

Permalink
Moved digital post settings into config. Added support for os2web_key…
Browse files Browse the repository at this point in the history
… to get certificate.
  • Loading branch information
rimi-itk committed May 7, 2024
1 parent 65e1cb2 commit 7410949
Show file tree
Hide file tree
Showing 20 changed files with 419 additions and 398 deletions.
31 changes: 10 additions & 21 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
composer validate --strict composer.json
# Check that dependencies resolve.
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Check that composer file is normalized
run: |
composer normalize --dry-run
php-coding-standards:
name: PHP coding standards
Expand Down Expand Up @@ -111,27 +114,13 @@ jobs:
run: |
./scripts/code-analysis
markdownlint:
coding-standards-markdown:
name: Markdown coding standards
runs-on: ubuntu-latest
name: markdownlint
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn packages
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Yarn install
uses: actions/setup-node@v2
with:
node-version: '20'
- run: yarn install
- name: markdownlint
run: yarn coding-standards-check/markdownlint
uses: actions/checkout@master

- name: Coding standards
run: |
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md'
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
composer.lock
vendor

node_modules/
yarn.lock
13 changes: 13 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"default": true,
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
"line-length": {
"line_length": 120,
"code_blocks": false,
"tables": false
},
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
"no-duplicate-heading": {
"siblings_only": true
}
}
18 changes: 0 additions & 18 deletions .markdownlintrc

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ before starting to add changes. Use example [placed in the end of the page](#exa

## [Unreleased]

- [#101](https://github.com/OS2Forms/os2forms/pull/101)
Added support for os2web_key

## [3.15.0] 2024-05-03

- Added webform encryption modules
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,29 +122,27 @@ run the checks locally.

```sh
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer install
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-check

# Fix (some) coding standards issues.
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-apply
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-check
```

### Markdown

```sh
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn install
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-check/markdownlint

# Fix (some) coding standards issues.
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-apply/markdownlint
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md' --fix
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md'
```

## Code analysis

We use [PHPStan](https://phpstan.org/) for static code analysis.

Running statis code analysis on a standalone Drupal module is a bit tricky, so
we use a helper script to run the analysis:
Running statis code analysis on a standalone Drupal module is a bit tricky, so we use a helper script to run the
analysis:

```sh
./scripts/code-analysis
```shell
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm ./scripts/code-analysis
```

**Note**: Currently the code analysis is only run on the `os2forms_digital_post` sub-module (cf. [`phpstan.neon`](./phpstan.neon)).
90 changes: 44 additions & 46 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
{
"name": "os2forms/os2forms",
"type": "drupal-module",
"description": "Drupal 8 OS2Form module provides advanced webform functionality for Danish Municipalities",
"minimum-stability": "dev",
"prefer-stable": true,
"license": "EUPL-1.2",
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"assets": {
"type": "composer",
"url": "https://asset-packagist.org"
}
},
"type": "drupal-module",
"require": {
"php": "^8.1",
"ext-dom": "*",
Expand Down Expand Up @@ -47,7 +35,7 @@
"drupal/mailsystem": "^4.1",
"drupal/masquerade": "^2.0@RC",
"drupal/pathauto": "^1.5",
"drupal/permissions_by_term": "^3.1 || ^2.25",
"drupal/permissions_by_term": "^2.25 || ^3.1",
"drupal/queue_mail": "^1.4",
"drupal/queue_ui": "^2.1",
"drupal/r4032login": "^2.1",
Expand Down Expand Up @@ -77,11 +65,12 @@
"itk-dev/beskedfordeler-drupal": "^1.0",
"itk-dev/serviceplatformen": "dev-feature/guzzle6-adapter as 1.5",
"os2web/os2web_datalookup": "^1.5",
"os2web/os2web_key": "dev-os2web_key",
"os2web/os2web_nemlogin": "^1.0",
"php-http/guzzle6-adapter": "^2.0",
"phpoffice/phpword": "^0.18.2",
"symfony/options-resolver": "^5.4 || ^6.0",
"tecnickcom/tcpdf": "~6",
"tecnickcom/tcpdf": "^6",
"webmozart/path-util": "^2.3",
"wsdltophp/packagebase": "^5.0",
"zaporylie/composer-drupal-optimizations": "^1.2"
Expand All @@ -90,25 +79,45 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"drupal/coder": "^8.3",
"drupal/maillog": "^1.0",
"ergebnis/composer-normalize": "^2.42",
"mglaman/phpstan-drupal": "^1.1",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpunit/phpunit": "^9.5",
"wsdltophp/packagegenerator": "^4.0"
},
"extra" : {
"repositories": {
"os2web/os2web_key": {
"type": "vcs",
"url": "https://github.com/itk-dev/os2web_key"
},
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"assets": {
"type": "composer",
"url": "https://asset-packagist.org"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"allow-plugins": {
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true,
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": true,
"vaimo/composer-patches": true,
"zaporylie/composer-drupal-optimizations": true
},
"sort-packages": true
},
"extra": {
"composer-exit-on-patch-failure": false,
"enable-patching" : true,
"enable-patching": true,
"patches": {
"drupal/entity_print": {
"2733781 - Add Export to Word Support": "https://www.drupal.org/files/issues/2019-11-22/2733781-47.patch"
},
"drupal/webform": {
"Unlock possibility of using Entity print module export to Word": "https://www.drupal.org/files/issues/2020-02-29/3096552-6.patch"
},
"drupal/user_default_page": {
"Warning: in_array() expects parameter 2 to be array, null given in user_default_page_user_logout() (https://www.drupal.org/node/3246986)": "https://www.drupal.org/files/issues/2021-11-01/user_default_page-3246986-2.patch"
},
"drupal/coc_forms_auto_export": {
"3240592 - Problem with phpseclib requirement in 2.x (https://www.drupal.org/project/coc_forms_auto_export/issues/3240592)": "https://www.drupal.org/files/issues/2021-10-04/requirement-namespace-3240592-1.patch"
},
Expand All @@ -121,34 +130,23 @@
}
},
"scripts": {
"code-analysis/phpstan": [
"phpstan analyse"
],
"code-analysis": [
"@code-analysis/phpstan"
],
"coding-standards-check/phpcs": [
"phpcs --standard=phpcs.xml.dist"
"code-analysis/phpstan": [
"phpstan analyse"
],
"coding-standards-check": [
"@coding-standards-check/phpcs"
"coding-standards-apply": [
"@coding-standards-apply/phpcs"
],
"coding-standards-apply/phpcs": [
"phpcbf --standard=phpcs.xml.dist"
],
"coding-standards-apply": [
"@coding-standards-apply/phpcs"
"coding-standards-check": [
"@coding-standards-check/phpcs"
],
"coding-standards-check/phpcs": [
"phpcs --standard=phpcs.xml.dist"
]
},
"config": {
"sort-packages": true,
"allow-plugins": {
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": true,
"vaimo/composer-patches": true,
"zaporylie/composer-drupal-optimizations": true
}
}
}
4 changes: 4 additions & 0 deletions modules/os2forms_digital_post/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ examples](modules/os2forms_digital_post_examples/README.md).
Go to `/admin/os2forms_digital_post/settings` to set up global settings for
digital post.

### Key

We use [os2web_key](https://github.com/OS2web/os2web_key) to provide the certificate for sending digital post.

### Queue

The actual sending of digital post is handled by jobs in an [Advanced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
- 'beskedfordeler:beskedfordeler'
- 'drupal:advancedqueue'
- 'os2web_datalookup:os2web_datalookup'
- 'os2web_key:os2web_key'
- 'webform:webform'
- 'webform:webform_submission_log'

Expand Down
9 changes: 9 additions & 0 deletions modules/os2forms_digital_post/os2forms_digital_post.install
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ use Drupal\os2forms_digital_post\Helper\BeskedfordelerHelper;
function os2forms_digital_post_schema() {
return Drupal::service(BeskedfordelerHelper::class)->schema();
}

/**
* Implements hook_update_N().
*/
function os2forms_digital_post_update_9001() {
\Drupal::service('module_installer')->install([
'os2web_key',
], TRUE);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ services:

Drupal\os2forms_digital_post\Helper\Settings:
arguments:
- "@keyvalue"
- "@config.factory"
- "@key.repository"

Drupal\os2forms_digital_post\Helper\CertificateLocatorHelper:
arguments:
- "@Drupal\\os2forms_digital_post\\Helper\\Settings"
- "@key.repository"

Drupal\os2forms_digital_post\Helper\MeMoHelper:
arguments:
Expand All @@ -30,7 +32,7 @@ services:
Drupal\os2forms_digital_post\Helper\DigitalPostHelper:
arguments:
- "@Drupal\\os2forms_digital_post\\Helper\\Settings"
- "@Drupal\\os2forms_digital_post\\Helper\\CertificateLocatorHelper"
- "@Drupal\\os2web_key\\CertificateHelper"
- "@plugin.manager.os2web_datalookup"
- "@Drupal\\os2forms_digital_post\\Helper\\MeMoHelper"
- "@Drupal\\os2forms_digital_post\\Helper\\ForsendelseHelper"
Expand Down

This file was deleted.

Loading

0 comments on commit 7410949

Please sign in to comment.