Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/os2forms nemid only log when relevant #149

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa

## [Unreleased]

## [3.20.1] 2024-12-10

- Avoided accessing non-initialized property when logging in `os2forms_nemid`.

## [3.20.0] 2024-12-09

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

[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.20.0...HEAD
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.20.1...HEAD
[3.20.1]: https://github.com/OS2Forms/os2forms/compare/3.20.0...3.20.1
[3.20.0]: https://github.com/OS2Forms/os2forms/compare/3.19.0...3.20.0
[3.19.0]: https://github.com/OS2Forms/os2forms/compare/3.18.0...3.19.0
[3.18.0]: https://github.com/OS2Forms/os2forms/compare/3.17.0...3.18.0
Expand Down
12 changes: 9 additions & 3 deletions modules/os2forms_nemid/src/Service/FormsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,15 @@ public function retrieveCprLookupResult(FormStateInterface $form_state) {
$authProviderPlugin = $this->getAuthProvider($form_state);

$userCpr = $authProviderPlugin->fetchValue('cpr');
$lookedUpCpr = $cprLookupResult->getCpr();

$this->auditLogger->info('DataLookup', 'User with cpr ' . $userCpr . ' looked up cpr ' . $lookedUpCpr);
$lookedUpCpr = $cprLookupResult->getFieldValue('cpr');

// Current method is called whenever the webform is rendered.
// As a result, it is also called in situations where both
// userCpr and lookedUpCpr does not make sense, e.g.
// adding an element to a webform.
if ($userCpr && $lookedUpCpr) {
$this->auditLogger->info('DataLookup', 'User with cpr ' . $userCpr . ' looked up cpr ' . $lookedUpCpr);
}

return $cprLookupResult;
}
Expand Down
Loading