Problem/Motivation
Once an order belongs to an organization, the organization drives access (fail-closed): uid ownership applies only to orders without an organization, so a buyer who leaves the organization loses access. Only the module that owns membership (commerce_b2b) grants access back. Parent: #3638816: [META] Commerce 4.x roadmap.
Depends on the 4.0 access seams (the checkout and update_cart order operations), not in 4.x yet.
Proposed resolution
Withdraw the uid grants where they are granted, each a check on $order->getOrganizationId() === NULL; no shared ownership service. commerce_checkout and commerce_payment stay agnostic of organizations.
OrderAccessControlHandler,view: "view own commerce_order" only for orders without an organization.OrderAccessControlHandler,checkout: the uid check only for orders without an organization; forbidden when the order's organization is unpublished.- commerce_cart's order access hook: neutral for orders with an organization (
view,update_cart). - commerce_cart's
QueryAccessSubscriber: leaves out carts with an organization. OrderQueryAccessHandler, "view own": theuidcondition also requires no organization. Not listed in the design doc, but without it "My orders" lists organization orders that entity access then denies.
User interface changes
With commerce_organization alone, a member cannot view, edit or check out their own organization cart or orders; admins still can. Orders without an organization get the same access as today.
Remaining tasks
- Kernel tests for entity and query access, with and without an organization.
Issue fork commerce-3641083
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
jsacksick commented