Skip to content

Commit 2ce4685

Browse files
committed
Added audit logging to FBS handler
1 parent 4ea0f62 commit 2ce4685

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1313

1414
- Added webform ID to digital post audit logging messages.
1515
- Added audit logging to `os2forms_fasit`
16+
- Added audit logging to `os2forms_fbs_handler`
1617

1718
## [3.19.0] 2024-12-06
1819

modules/os2forms_fbs_handler/os2forms_fbs_handler.info.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ core_version_requirement: ^9 || ^10
66
dependencies:
77
- 'webform:webform'
88
- 'advancedqueue:advancedqueue'
9+
- 'os2web:os2web_audit'

modules/os2forms_fbs_handler/src/Plugin/AdvancedQueue/JobType/FbsCreateUser.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Drupal\os2forms_fbs_handler\Client\FBS;
1212
use Drupal\os2forms_fbs_handler\Client\Model\Guardian;
1313
use Drupal\os2forms_fbs_handler\Client\Model\Patron;
14+
use Drupal\os2web_audit\Service\Logger;
1415
use Drupal\webform\Entity\WebformSubmission;
1516
use GuzzleHttp\Client;
1617
use GuzzleHttp\Exception\GuzzleException;
@@ -41,6 +42,7 @@ public function __construct(
4142
$plugin_definition,
4243
LoggerChannelFactoryInterface $loggerFactory,
4344
protected readonly Client $client,
45+
protected readonly Logger $auditLogger,
4446
) {
4547
parent::__construct($configuration, $plugin_id, $plugin_definition);
4648
$this->submissionLogger = $loggerFactory->get('webform_submission');
@@ -55,7 +57,8 @@ public static function create(ContainerInterface $container, array $configuratio
5557
$plugin_id,
5658
$plugin_definition,
5759
$container->get('logger.factory'),
58-
$container->get('http_client')
60+
$container->get('http_client'),
61+
$container->get('os2web_audit.logger'),
5962
);
6063
}
6164

@@ -121,6 +124,9 @@ public function process(Job $job): JobResult {
121124

122125
$this->submissionLogger->notice($this->t('The submission #@serial was successfully delivered', ['@serial' => $webformSubmission->serial()]), $logger_context);
123126

127+
$msg = sprintf('Successfully created FBS patron with cpr %s and guardian with cpr %s. Webform id %s.', $data['barn_cpr'], $data['cpr'], $webformSubmission->getWebform()->id());
128+
$this->auditLogger->info('FBS', $msg);
129+
124130
return JobResult::success();
125131
}
126132
catch (\Exception | GuzzleException $e) {

0 commit comments

Comments
 (0)