Problem/Motivation
ProductVariationCreateAccessCheck handles access to both the variation add page (/product/{commerce_product}/variations/add) and the add form (/product/{commerce_product}/variations/add/{commerce_product_variation_type}).
When a variation type is present in the route, it correctly checks create access for that type. However, it then ORs in create access for every variation type allowed by the product type. That loop is only meant for the add page, where no variation type is selected yet.
As a result, on a product type with multiple variation types, a user with the "Manage" permission for only one of them can open the add form for any of the others and create variations of a type they aren't allowed to manage. They can't edit or delete those variations afterwards, which shows the permissions were checked as intended everywhere else.
Proposed resolution
Only check create access for every variation type on the add page. When a variation type is in the route, only check create access for that type.
Remaining tasks
- Review the MR.
User interface changes
None.
API changes
None.
Issue fork commerce-3641214
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 commentedComment #7
jsacksick commented