Skip to content

Commit 4336303

Browse files
committed
Added support for Key
1 parent c4707bc commit 4336303

17 files changed

+408
-213
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#### Link to ticket
2+
3+
Please add a link to the ticket being addressed by this change.
4+
5+
#### Description
6+
7+
Please include a short description of the suggested change and the reasoning behind the approach you have chosen.
8+
9+
#### Screenshot of the result
10+
11+
If your change affects the user interface you should include a screenshot of the result with the pull request.
12+
13+
#### Checklist
14+
15+
- [ ] My code is covered by test cases.
16+
- [ ] My code passes our test (all our tests).
17+
- [ ] My code passes our static analysis suite.
18+
- [ ] My code passes our continuous integration process.
19+
20+
If your code does not pass all the requirements on the checklist you have to add a comment explaining why this change
21+
should be exempt from the list.
22+
23+
#### Additional comments or questions
24+
25+
If you have any further comments or questions for the reviewer please add them here.

.github/workflows/pr.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
composer validate --strict composer.json
5050
# Check that dependencies resolve.
5151
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
52+
- name: Check that composer file is normalized
53+
run: |
54+
composer normalize --dry-run
5255
5356
php-check-coding-standards:
5457
name: PHP - Check Coding Standards
@@ -140,3 +143,14 @@ jobs:
140143
sed -i '/^\s*"require":/,/^\s*}/d' composer.json
141144
composer --no-interaction install
142145
composer code-analysis
146+
147+
coding-standards-markdown:
148+
name: Markdown coding standards
149+
runs-on: ubuntu-latest
150+
steps:
151+
- name: Checkout
152+
uses: actions/checkout@master
153+
154+
- name: Coding standards
155+
run: |
156+
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md'

.markdownlint.jsonc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": true,
3+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
4+
"line-length": {
5+
"line_length": 120,
6+
"code_blocks": false,
7+
"tables": false
8+
},
9+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
10+
"no-duplicate-heading": {
11+
"siblings_only": true
12+
}
13+
}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ about writing changes to this log.
88

99
## [Unreleased]
1010

11+
* [PR-1](https://github.com/itk-dev/os2forms_get_organized/pull/1)
12+
Added support for os2web_key
13+
1114
## [1.1.5] 04.01.2024
1215

1316
* Disallowed `webform_entity_print_attachment:pdf` attachment element.

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,37 @@ vendor/bin/drush pm:enable os2forms_get_organized
1111

1212
## Settings
1313

14-
Set GetOrganized `username`, `password` and `base url`
15-
on `/admin/os2forms_get_organized/settings`.
16-
17-
You can also test that the provided
18-
details work on `/admin/os2forms_get_organized/settings`.
14+
Go to `/admin/os2forms_get_organized/settings` and configure the module.
1915

2016
## Coding standards
2117

22-
Check coding standards:
18+
Our coding are checked by GitHub Actions (cf. [.github/workflows/pr.yml](.github/workflows/pr.yml)). Use the commands
19+
below to run the checks locally.
2320

24-
```sh
25-
docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer install
26-
docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer coding-standards-check
21+
### PHP
22+
23+
```shell
24+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer install
25+
# Fix (some) coding standards issues
26+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-apply
27+
# Check that code adheres to the coding standards
28+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-check
29+
```
30+
31+
### Markdown
32+
33+
```shell
34+
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md' --fix
35+
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md'
2736
```
2837

29-
Apply coding standards:
38+
## Code analysis
39+
40+
We use [PHPStan](https://phpstan.org/) for static code analysis.
41+
42+
Running statis code analysis on a standalone Drupal module is a bit tricky, so we use a helper script to run the
43+
analysis:
3044

3145
```shell
32-
docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer coding-standards-apply
33-
docker run --rm --interactive --tty --volume ${PWD}:/app node:18 yarn --cwd /app coding-standards-apply
46+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm ./scripts/code-analysis
3447
```

composer.json

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,64 @@
11
{
22
"name": "os2forms/os2forms_get_organized",
33
"description": "OS2Forms GetOrganized integration",
4-
"type": "drupal-module",
54
"license": "MIT",
5+
"type": "drupal-module",
66
"authors": [
77
{
88
"name": "Jeppe Kuhlmann Andersen",
99
"email": "[email protected]"
1010
}
1111
],
12-
"minimum-stability": "dev",
13-
"prefer-stable": true,
14-
"repositories": [
15-
{
16-
"type": "composer",
17-
"url": "https://packages.drupal.org/8"
18-
}
19-
],
2012
"require": {
21-
"itk-dev/getorganized-api-client-php": "^1.2",
22-
"drupal/webform": "^6.1",
2313
"drupal/advancedqueue": "^1.0",
24-
"symfony/options-resolver": "^5.4",
25-
"os2forms/os2forms": "^3.13"
14+
"drupal/key": "^1.17",
15+
"drupal/webform": "^6.1",
16+
"itk-dev/getorganized-api-client-php": "^1.2",
17+
"os2forms/os2forms": "^3.13",
18+
"symfony/options-resolver": "^5.4"
2619
},
2720
"require-dev": {
2821
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
2922
"drupal/coder": "^8.3",
23+
"ergebnis/composer-normalize": "^2.42",
3024
"mglaman/drupal-check": "^1.4"
3125
},
26+
"repositories": [
27+
{
28+
"type": "composer",
29+
"url": "https://packages.drupal.org/8"
30+
}
31+
],
32+
"minimum-stability": "dev",
33+
"prefer-stable": true,
34+
"config": {
35+
"allow-plugins": {
36+
"cweagans/composer-patches": true,
37+
"dealerdirect/phpcodesniffer-composer-installer": true,
38+
"ergebnis/composer-normalize": true,
39+
"simplesamlphp/composer-module-installer": true,
40+
"zaporylie/composer-drupal-optimizations": true
41+
}
42+
},
3243
"scripts": {
44+
"code-analysis": [
45+
"@code-analysis/drupal-check"
46+
],
3347
"code-analysis/drupal-check": [
3448
"# @see https://github.com/mglaman/drupal-check/issues/261#issuecomment-1030141772 for details on exclude-dir value",
3549
"drupal-check --deprecations --analysis --exclude-dir='vendor,*/Client/*' *.* src"
3650
],
37-
"code-analysis": [
38-
"@code-analysis/drupal-check"
51+
"coding-standards-apply": [
52+
"@coding-standards-apply/phpcs"
3953
],
40-
"coding-standards-check/phpcs": [
41-
"vendor/bin/phpcs --standard=phpcs.xml.dist"
54+
"coding-standards-apply/phpcs": [
55+
"vendor/bin/phpcbf --standard=phpcs.xml.dist"
4256
],
4357
"coding-standards-check": [
4458
"@coding-standards-check/phpcs"
4559
],
46-
"coding-standards-apply/phpcs": [
47-
"vendor/bin/phpcbf --standard=phpcs.xml.dist"
48-
],
49-
"coding-standards-apply": [
50-
"@coding-standards-apply/phpcs"
60+
"coding-standards-check/phpcs": [
61+
"vendor/bin/phpcs --standard=phpcs.xml.dist"
5162
]
52-
},
53-
"config": {
54-
"allow-plugins": {
55-
"dealerdirect/phpcodesniffer-composer-installer": true,
56-
"zaporylie/composer-drupal-optimizations": true,
57-
"cweagans/composer-patches": true,
58-
"simplesamlphp/composer-module-installer": true
59-
}
6063
}
6164
}

drush.services.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
Drupal\os2forms_get_organized\Drush\Commands\GetOrganizedTestCommands:
3+
arguments:
4+
- '@Drupal\os2forms_get_organized\Helper\ArchiveHelper'
5+
tags:
6+
- { name: drush.command }

os2forms_get_organized.info.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ description: 'GetOrganized integration'
44
package: OS2Forms
55
core_version_requirement: ^9
66
dependencies:
7-
- drupal:webform
87
- drupal:advancedqueue
8+
- drupal:key
9+
- drupal:webform
910
- drupal:webform_entity_print_attachment
1011
- os2forms:os2forms_attachment
12+
1113
configure: os2forms_get_organized.admin.settings

os2forms_get_organized.install

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Install hooks for os2forms_get_organized.
6+
*/
7+
8+
/**
9+
* Implements hook_update_N().
10+
*/
11+
function os2forms_get_organized_update_9001(): void {
12+
\Drupal::service('module_installer')->install([
13+
'key',
14+
], TRUE);
15+
}

os2forms_get_organized.services.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
services:
22
Drupal\os2forms_get_organized\Helper\Settings:
33
arguments:
4-
- "@keyvalue"
4+
- "@config.factory"
5+
- "@key.repository"
56

67
Drupal\os2forms_get_organized\Helper\ArchiveHelper:
78
arguments:

0 commit comments

Comments
 (0)