MailjetConfigurationAccessCheck should use proper dependency injection

Created on 28 January 2025, 2 months ago

Problem/Motivation

In the Drupal\mailjet\Access\MailjetConfigurationAccessCheck class, the only existing dependency injection is the current_user service which is not used properly nor should it be as explained in the Advanced route access checking documentation :

Make sure not to mix up the $user coming from \Drupal::currentUser() and AccountInterface $account. Always perform logic against AccountInterface $account.

Proposed resolution

Refactor the Drupal\mailjet\Access\MailjetConfigurationAccessCheck class to use proper dependency injection and use the $account parameter instead of the current_user service.

Remaining tasks

  1. Remove the current_user dependency injection
  2. Use the $account parameter in the access() method
  3. Add a dependency injection for the config service
  4. Add a dependency injection for the messenger service
  5. Use the optional $route parameter in the access() method instead of the $_SERVER global variable
📌 Task
Status

Active

Version

4.0

Component

Code

Created by

🇧🇪Belgium oldeb Namur 🇧🇪

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024