- Issue created by @davidwbarratt
- πΊπΈUnited States smustgrave
Thanks for the suggestion
Will probably need a simple test case around this and probably convert 1-2 spots in core that could use this to show it's needed.
- πΊπΈUnited States davidwbarratt
I'm kind of shocked that hook_query_TAG_alter, at least for the purposes of access, is only used by
node
in core with NodeHooks1::queryNodeAccessAlter which is kind of a beast.Ironically, the example for hook_query_TAG_alter is a hypothetical for the
media
module that would be greatly simplified by this change, which wouldn't use that hook in the first place.I'm not sure where a test should therefore belong? This change is effectively only useful for contrib modules to utilize until someone wants to take on the work of refactoring node access, in which this change I imagine would be helpful.
Any guidance you can provide would be helpful!
- πΊπΈUnited States davidwbarratt
It seems outside of the scope of this issue, but we could add a hook_entity_query_ENTITY_TYPE_alter for an entity type like
user
? For instance, if a user doesn't have theaccess user profiles
permission and the queryhasAccessCheck
than the query should immediately return zero results right? - πΊπΈUnited States davidwbarratt
We could persue a more comprehensive solution, which I've documented in #777578-245: Add an entity query access API and deprecate hook_query_ENTITY_TYPE_access_alter() β
- πΊπΈUnited States davidwbarratt
I'm closing this because a more comprehensive solution is needed. I've documented the problem more clearly at π QueryInterface::accessCheck does nothing Active