Add an entity query access API and deprecate hook_query_ENTITY_TYPE_access_alter()

Created on 21 April 2010, about 14 years ago
Updated 21 February 2024, 4 months ago

Summary

The node_access system is a somewhat obscure, yet powerful access control API. However, it is severely inhibited for a number of reasons:

  1. It is not widely understood
  2. It is hard to understand because of poor terminology and conflicting use of terminology
  3. It is limited the the Node entity type

The proposal is to implement a new entity-type agnostic access control API that will sit alongside existing systems (not replace permissions/roles, or node_access for BC reasons). We are now ideally positioned to finally implement a new system because of Drupal 8's release cycle and its much better understood and coherent entity system. That is, entities are finally first-class citizens.

TL;DR:
hook_entity_access()'s limitation:

Note that this hook is not called for listings (e.g., from entity queries
and Views). For nodes, see Node access rights β†’ for
a full explanation. For other entity types, see hook_query_TAG_alter β†’ ().

should be removed and replaced by a general Entity Access API logic, which works

  • for all kind of entities (Unification & DX)
  • in all kind of access implementations (Unification & DX)
  • in all relevant situations (Views, EntityQuery, ...) (Unification, DX & SBX)

so developers don't have to fight forbidden entities appearing in views anymore, understanding the Node Grants / Access Records special logics etc. for better DX and security improvements.

Please contribute to technical proposal for a generic entity grants system in Drupal 8 Core

We want to reach a consensus about the architecture and terminology used in the new generic entity access system before we start with the implementation. Therefore, the audience of the proposal is for technical maintainers of Drupal core and people following the drupal.org issue.
https://docs.google.com/document/d/1jIWKVoYbdVeEg-Kz_5yvlMvi7PycoHZWg4xX...

Related issues

#1810320: Remove EntityTranslationControllerInterface::getAccess() once have entity access β†’ is postponed on this issue.

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
EntityΒ  β†’

Last updated 21 minutes ago

Created by

πŸ‡ΊπŸ‡ΈUnited States Dave Reid Nebraska πŸ‡ΊπŸ‡Έ

Live updates comments and jobs are added and updated live.
  • Security improvements

    It makes Drupal less vulnerable to abuse or misuse. Note, this is the preferred tag, though the Security tag has a large body of issues tagged to it. Do NOT publicly disclose security vulnerabilities; contact the security team instead. Anyone (whether security team or not) can apply this tag to security improvements that do not directly present a vulnerability e.g. hardening an API to add filtering to reduce a common mistake in contributed modules.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

Production build 0.69.0 2024