Skip to content

Commit b244c35

Browse files
committed
Merge branch 'feature/os2forms-nemid-only-log-when-relevant'
2 parents 254adf0 + 89bd5c3 commit b244c35

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1111

1212
## [Unreleased]
1313

14+
## [3.20.1] 2024-12-10
15+
16+
- Avoided accessing non-initialized property when logging in `os2forms_nemid`.
17+
1418
## [3.20.0] 2024-12-09
1519

1620
- Added webform ID to digital post audit logging messages.
@@ -314,7 +318,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa
314318
- Security in case of vulnerabilities.
315319
```
316320

317-
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.20.0...HEAD
321+
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.20.1...HEAD
322+
[3.20.1]: https://github.com/OS2Forms/os2forms/compare/3.20.0...3.20.1
318323
[3.20.0]: https://github.com/OS2Forms/os2forms/compare/3.19.0...3.20.0
319324
[3.19.0]: https://github.com/OS2Forms/os2forms/compare/3.18.0...3.19.0
320325
[3.18.0]: https://github.com/OS2Forms/os2forms/compare/3.17.0...3.18.0

modules/os2forms_nemid/src/Service/FormsHelper.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,15 @@ public function retrieveCprLookupResult(FormStateInterface $form_state) {
147147
$authProviderPlugin = $this->getAuthProvider($form_state);
148148

149149
$userCpr = $authProviderPlugin->fetchValue('cpr');
150-
$lookedUpCpr = $cprLookupResult->getCpr();
151-
152-
$this->auditLogger->info('DataLookup', 'User with cpr ' . $userCpr . ' looked up cpr ' . $lookedUpCpr);
150+
$lookedUpCpr = $cprLookupResult->getFieldValue('cpr');
151+
152+
// Current method is called whenever the webform is rendered.
153+
// As a result, it is also called in situations where both
154+
// userCpr and lookedUpCpr does not make sense, e.g.
155+
// adding an element to a webform.
156+
if ($userCpr && $lookedUpCpr) {
157+
$this->auditLogger->info('DataLookup', 'User with cpr ' . $userCpr . ' looked up cpr ' . $lookedUpCpr);
158+
}
153159

154160
return $cprLookupResult;
155161
}

0 commit comments

Comments
 (0)