You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Function user_access does something different and rightly has different params.)
Not two of those specific entity access functions use the same parameter handling. I'm aware that all this code has grown over time, but wasn't there a base concept initially? If so - what did it look like? And most of all - would it be possible to standardize?
Here some more specific questions re parameters:
How many params should they have?
Which ones should be optional - if any?
How to deal with the optional params (which checks to run - only admin access or all that might apply)?
This inconsistency has caused some trouble when trying to consolidate file access functions, but also causes other problems.
A small collection:
I'm aware that standardizing might be a 2.x task, but at least we could establish a policy regarding entity access functions. Without more consistency function entity_access won't ever be able to do something useful without a lot of exemptions and workarounds.
The text was updated successfully, but these errors were encountered:
An alternative would be to create new methods in all core entity classes to check access without an entity given (globalAccess() or accessAllBundles()...).
This has been discussed in #5474 to provide a way for entity_access to do checks independently from an existing entity. If a user has permission to bypass access control, or to do the operation on any type/bundle, anyway, an entity isn't necessary. That would work better than creating dummy entities - which requires special handling for some entity types.
If the classes provide that instance-agnostic check, we could safely ignore the various differences in the XXX_access() function params and use the methods instead.
What we currently have:
(Function user_access does something different and rightly has different params.)
Not two of those specific entity access functions use the same parameter handling. I'm aware that all this code has grown over time, but wasn't there a base concept initially? If so - what did it look like? And most of all - would it be possible to standardize?
Here some more specific questions re parameters:
This inconsistency has caused some trouble when trying to consolidate file access functions, but also causes other problems.
A small collection:
entity_access()
to check for operations view, update and delete if no entity is provided #5474I'm aware that standardizing might be a 2.x task, but at least we could establish a policy regarding entity access functions. Without more consistency function entity_access won't ever be able to do something useful without a lot of exemptions and workarounds.
The text was updated successfully, but these errors were encountered: