Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291119

Extend BlockInterface::access to allow passing in an account

$
0
0

Problem/Motivation

The Drupal\block\BlockInterface::access() method (and it's implementation in Drupal\block\BlockBase)
does not allow to check access for a specific account, but just for the global user.

This may prevent BlockAccessController from working correctly, if access for an account is checked.
I stumbled over this in the refactoring of the AccessControllerInterface in #1947892: Improve DX with EntityAccessControllerInterface

Proposed resolution

Extend ::access() method (see "API changes")

Remaining tasks

Extend interface
Alter implementations
Update BlockAccessController ( #1947892: Improve DX with EntityAccessControllerInterface )
Write a test for BlockBase::access() with and without passed account.

User interface changes

None

API changes

Change BlockInterface::access() to

<?php
public function access(Drupal\user\Plugin\Core\Entity\User $user = NULL);
?>

#1947892: Improve DX with EntityAccessControllerInterface


Viewing all articles
Browse latest Browse all 291119

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>