Convert CheckProvider to use a service locator

Created on 22 January 2024, 11 months ago
Updated 26 February 2024, 10 months ago

Problem/Motivation

In πŸ“Œ Fork Symfony's ContainerAwareTrait and ContainerAwareInterface into core Needs work we are trying to reduce the use of ContainerAwareTrait as Symfony has deprecated it.

Drupal\Core\Access\CheckProvider is container aware because it needs to retrieve access checker services, but does not necessarily iterate over all of them.

Instead of injecting the container we can inject a service locator that only contains access checker services.

Steps to reproduce

Proposed resolution

Inject a service locator.

Also inject the dynamic_access_check_services parameter instead of retrieving it from the container.

Merge request link

Remaining tasks

Consider removing the dynamic_access_check_services parameter in a followup, as we can detect dynamic classes directly inside the service instead of injecting the list separately.

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 23 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom longwave UK

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

Merge Requests

Comments & Activities

  • Issue created by @longwave
  • Merge request !6279Convert CheckProvider. β†’ (Open) created by longwave
  • Status changed to Needs review 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom longwave UK
  • Pipeline finished with Success
    11 months ago
    #81067
  • πŸ‡¬πŸ‡§United Kingdom longwave UK
  • πŸ‡³πŸ‡±Netherlands spokje

    Besides a question in the MR about this needing a CR this seems fine to me.

    If it _does_ need a CR we might consider doing removing the dynamic_access_check_services parameter in here to prevent a CR on another CR?

  • Status changed to Needs work 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Yeah, let's write a change record just in case. Probably need this for the sister issues too...

    Unsure about refactoring dynamic_access_check_services here as well, that would probably warrant a separate change record anyway as we are removing a container parameter.

  • Status changed to Needs review 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    As in the LoggerChannelFactory issue I think we can add BC and point the deprecation notice directly to this issue.

  • Status changed to RTBC 11 months ago
  • πŸ‡³πŸ‡±Netherlands spokje

    I think we can add BC and point the deprecation notice directly to this issue.

    Never seen that before, but hey, you're a Core Committer, so that's probably OK.

    The only reason I can think of that it wouldn't be is that phpstan-drupal and drupal rector watch the published CRs automagically to determine if action is needed in either.

    But with this:

    This service is private and I think the chances of anyone overriding it are low.

    I agree chances are pretty low on that.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Re #8 over in πŸ“Œ Replace REQUEST_TIME in classes with direct container access Fixed we linked the new $time argument messages directly to the issue, so I assume it's OK to do here as well.

  • πŸ‡³πŸ‡±Netherlands spokje

    I'm OK with that :)

    • catch β†’ committed e85a9e85 on 11.x
      Issue #3416353 by longwave, Spokje: Convert CheckProvider to use a...
  • Status changed to Fixed 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch

    I also think linking to the issue directly is a reasonable approach where we don't expect anyone to have to make changes and the CR would would have nothing useful to say about the change. Committed/pushed to 11.x, thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024