Deprecate empty AccessInterface and remove usages

Created on 13 May 2014, about 10 years ago
Updated 8 May 2024, about 1 month ago

Problem/Motivation

Follow-up from #2222719: Use parameter matching via reflection for access checks instead of pulling variables from request attributes β†’ .

Drupal\Core\Routing\Access\AccessInterface is empty. Access check methods can have different method parameters for different access checkers, so it is not possible to express that with a single interface. Therefore this interface is pointless and should be deprecated.

Proposed resolution

  • Deprecate AccessIntreface for removal before Drupal 11.0.0 release.
  • Leave AccessInterface in core until shortly before Drupal 11, for BC.

Remaining tasks

User interface changes

None.

API changes

We'd be marking part of an API as deprecated, but it's not tagged @api, and the plan is to leave the interface itself in core.

So while we're discouraging the use of an API, we're also not breaking or changing it.

Data model changes

None.

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
RoutingΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
  • Needs documentation

    A documentation change is requested elsewhere. For Drupal core (and possibly other projects), once the change has been committed, this status should be recorded in a change record node.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France andypost

    I think #53 is a way to go

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    We could create more than one interface. For example:

    /**
     * Access rules for a route.
     */
    interface RouteAccessInterface {
    
    	public function access(AccountInterface $account, RouteMatchInterface $route): AccessResultInterface;
    
    }
    

    Taking this a step further, in a routing file, if the class defined in _form implements this interface, then its ::access() method could be used automatically instead of having to be defined in _custom_access.

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    I updated the summary.

    If we are not going to deprecate AccessInterface then the @todo in its code should be replaced with an explanation of when the interface should be used.

  • Status changed to Active about 1 month ago
  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    Before we get into patches, we need to discuss what to do.

Production build 0.69.0 2024