Normally, coupons on a promotion are accessible if the user has access to update the underlying promotion. All good and fine except the coupon collection route which is taken over by Views and the permission is being set as the route requirement. Meaning that if the user doesnt have access to administer promotions (only to create and update), they will not have access to the listing of coupons.

The rigid views access should be replaced by the entity_access:commerce_promotion.update checker.

CommentFileSizeAuthor
#2 3249697-2.patch5.42 KBupchuk

Comments

Upchuk created an issue. See original summary.

upchuk’s picture

StatusFileSize
new5.42 KB

I made a patch that addresses this.

* I remove the access requirement on the View. No other way to remove the permission requirement
* I add the "commerce_promotion.update" _entity_access in the ALTER route subscriber so it comes after the View. Cannot do it in the CouponRouteProvider because of this.
* Added test coverage

upchuk’s picture

Status: Needs work » Needs review

  • jsacksick committed 9f2f49f on 3.0.x authored by Upchuk
    Issue #3249697 by Upchuk: Coupon collection route access doesn't work as...
jsacksick’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
Status: Needs review » Fixed

Committed to 3.0.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.