From 84e27166c2307a65129604cef28455a57b996f36 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Thu, 12 Dec 2024 13:24:31 +0100 Subject: [PATCH] ITKDev: Code review ajustments Co-authored-by: Jeppe Kuhlmann Andersen <78410897+jekuaitk@users.noreply.github.com> --- modules/os2web_audit_entity/os2web_audit_entity.info.yml | 2 +- .../os2web_audit_entity.links.menu.yml | 2 +- modules/os2web_audit_entity/os2web_audit_entity.module | 8 +------- modules/os2web_audit_entity/src/Form/SettingsForm.php | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/modules/os2web_audit_entity/os2web_audit_entity.info.yml b/modules/os2web_audit_entity/os2web_audit_entity.info.yml index f5d7f7c..2e421c7 100644 --- a/modules/os2web_audit_entity/os2web_audit_entity.info.yml +++ b/modules/os2web_audit_entity/os2web_audit_entity.info.yml @@ -1,5 +1,5 @@ name: "OS2web Audit logging entity access" -description: "Logs CUD events for entities" +description: "Logs CRUD events for entities" type: module core_version_requirement: ^8 || ^9 || ^10 dependencies: diff --git a/modules/os2web_audit_entity/os2web_audit_entity.links.menu.yml b/modules/os2web_audit_entity/os2web_audit_entity.links.menu.yml index b57f18b..0431128 100644 --- a/modules/os2web_audit_entity/os2web_audit_entity.links.menu.yml +++ b/modules/os2web_audit_entity/os2web_audit_entity.links.menu.yml @@ -1,5 +1,5 @@ os2web_audit_entity.admin_settings: title: 'OS2web Audit entity settings' parent: system.admin_config_system - description: 'Settings for the OS2 Audit entity module' + description: 'Settings for the OS2web Audit entity module' route_name: os2web_audit_entity.settings diff --git a/modules/os2web_audit_entity/os2web_audit_entity.module b/modules/os2web_audit_entity/os2web_audit_entity.module index 31e291f..7aef6e3 100644 --- a/modules/os2web_audit_entity/os2web_audit_entity.module +++ b/modules/os2web_audit_entity/os2web_audit_entity.module @@ -61,7 +61,6 @@ function os2web_audit_entity_webform_post_load_data(mixed $submissions): void { // Detect field of type that contains "cpr" in name or where field name // contains "cpr". - /** @var \Drupal\webform_revisions\Entity\WebformRevisions $webform */ $webform = $submission->getWebform(); $elements = $webform->getElementsDecoded(); foreach ($elements as $fieldName => $element) { @@ -125,12 +124,7 @@ function os2web_audit_entity_log(string $message): void { // Detect user type. $account = \Drupal::currentUser(); - $apiUser = FALSE; - if (os2web_audit_entity_is_api_user($account)) { - $apiUser = TRUE; - } - $metadata['userId'] = $account->getEmail(); - $metadata['userType'] = $apiUser ? 'api' : 'web'; + $metadata['userType'] = os2web_audit_entity_is_api_user($account) ? 'api' : 'web'; $logger->info('Entity', $message, FALSE, $metadata); } diff --git a/modules/os2web_audit_entity/src/Form/SettingsForm.php b/modules/os2web_audit_entity/src/Form/SettingsForm.php index d5b54ae..68ac2d3 100644 --- a/modules/os2web_audit_entity/src/Form/SettingsForm.php +++ b/modules/os2web_audit_entity/src/Form/SettingsForm.php @@ -70,8 +70,8 @@ public function buildForm(array $form, FormStateInterface $form_state): array { $form['roles'] = [ '#type' => 'checkboxes', - '#title' => $this->t('Choose an Option'), - '#description' => $this->t('Please select an option from the dropdown menu.'), + '#title' => $this->t('Select API access roles'), + '#description' => $this->t('The selected roles will be use to determine who is accessing entities through the API.'), '#options' => $items, '#default_value' => $config->get('roles') ?? [], '#required' => TRUE,