Closed (fixed)
Project:
Drupal core
Version:
10.3.x-dev
Component:
base system
Priority:
Normal
Category:
Plan
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2023 at 07:43 UTC
Updated:
12 Apr 2024 at 15:49 UTC
Jump to comment: Most recent
Comments
Comment #2
lauriiiI think it would be great to have framework managers review the plan on a high level to make sure that it's something that fits in core.
Comment #3
kristiaanvandeneyndeFor those interested, the current pitch is about getting this into core. I was asked about what would happen if we did not get this into core and ended up with the IS as shown here. The current pitch looks more like this:
Comment #4
kristiaanvandeneyndeWhoops
Comment #5
larowlanThis sounds like a great plan, and a good way to go about matching velocity with deliverables.
Removing the tag
Comment #6
larowlanAdding a really old related issue that this might provide a path forward on
Comment #7
kristiaanvandeneyndeUpdated IS to reflect #3 getting approval
Comment #8
kristiaanvandeneyndeComment #9
kristiaanvandeneyndeUpdated the IS to point to child tasks for an explanation of the remaining work.
Comment #10
kristiaanvandeneyndeComment #11
kristiaanvandeneyndeAdded the documentation that could go into the official drupal.org documentation here: #3381453: [policy/docs, no patch] Document the new access policy API
Comment #12
kristiaanvandeneyndeComment #13
frobThere is a 13 year old core issue about expanding the Entity Access system to match that of the Node Access system that should be considered here as well. #777578: Add an entity query access API and deprecate hook_query_ENTITY_TYPE_access_alter() Work has been done on that issue and a contrib module has been created to provide the functionality described there. https://www.drupal.org/project/raft_entity_access
Comment #14
frobComment #15
kristiaanvandeneyndeThat is about query access, which is completely different to what is being worked on here. The work here precedes that by building your permissions following policies. You can still take your built permissions to a query and try to get entity query access working.
Core currently has no generic entity query access, only node query access, and I even helped work on the system that went into Entity API to fix that problem space in contrib. It still needs fixing in core in my opinion, but that's not what this issue is about.
Comment #16
frobI think I've got it. This isn't about access at all but rather rules surrounding permissions and roles. Instead of a permission being an absolute value of yes or no it becomes an "it depends" type of check.
The reason I linked the other issue is that I could see policy that is checking a value within the entity (or a linking entity) to see if the policy is applied.
Some example scenarios:
Something in core that could depend on this API are the CRUD based own node permissions.
View published content is another place I could see switching to a policy over a permission.
Comment #17
kristiaanvandeneyndeNo not quite.
Policies determine which permissions you get in the system based on things you can deduce from the global context. As long as that context doesn't change, you always get the same permissions from these policies. What you're describing isn't Policy Based Access Control (PBAC), but Attribute Based Access Control (ABAC), which we already have in core in the form of hook_entity_access. You could perfectly take care of both your example scenarios with simple entity access hooks.
Where policy based access shines is that any permission check, doesn't even have to be entity related, can now have its outcome affected by which policies are currently active for the user. It could be that you receive entity-related permissions from a policy, but it's definitely not limited to that.
So it's more reasonable to consider ABAC a subset of PBAC. ABAC typically checks for both attributes and a permission, e.g.: "view unpublished content" is the permission part (PBAC) but the fact that this permission will always be checked in tandem with the "status" field is the ABAC part.
You can have PBAC without ABAC, but the other way around would often be really weird (although not inconceivable).
Comment #18
rivimeyIn #3 you mention the stretch goal -- I would suggest that this and a number of other policies (that make sense) are implemented to ensure that the API is in fact sufficient to implement them, even if those additional policies are later left as guide examples or even abandoned. With this sort of API it is really hard to ensure you have all the right interfaces and the right data available up front...
Comment #19
kristiaanvandeneyndeAgreed that it's rather hard to predict what people will be doing with the API, but keep in mind that Group has been running on this for quite a while already. So there is an example of it being useful to contrib. Having said that, the contract stipulates that the primary goal is to get this into core. If there's any budget left after that, I can definitely cook up a mini module or two that cover a single access policy.
Comment #20
nevergoneIs this expected in 11.0?
Comment #21
kristiaanvandeneynde10.3 if we can get the last issue committed in time. Part of it already is in 10.3
Comment #22
gábor hojtsy#3376846: Implement the new access policy API landed, woot! What else is left here!
Comment #27
kristiaanvandeneyndeNothing :)
Crediting those I spoke to about getting the ball rolling + those who helped with the many reviews. Feel free to ping me if I forgot anyone.
Comment #28
andypostThank you! Awaiting good write-ups to spread the knowledge
Comment #29
kristiaanvandeneyndeI submitted a session on this subject, would be cool if it got accepted.
Comment #30
naveenvalechaThank you everyone for the great work.
One less dependency for the sites using group module :) Looking forward to see the new release of group module.