Problem/Motivation

The promotion reorder page (/admin/commerce/promotions/reorder) is accessible with the access commerce_promotion overview permission, and lists the promotions the user can view. However, PromotionListBuilder::submitForm() saves the new weight of every listed promotion without checking update access.

As a result, a user who can view promotions but not edit them can still change their order, which affects which promotion applies when non-combinable promotions overlap. This is inconsistent with getDefaultOperations(), which already checks update access before showing the edit links.

Proposed resolution

Check update access per promotion on the reorder form:

  • Disable the weight field (and the drag handle) for promotions the user cannot update.
  • Hide the Save button when the user cannot update any of the listed promotions.
  • Skip promotions the user cannot update in submitForm().

Remaining tasks

  • Review the MR.

User interface changes

Users without update access to a promotion can no longer change its weight from the reorder page.

API changes

None.

Issue fork commerce-3641211

Command icon 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

jsacksick created an issue. See original summary.

  • jsacksick committed aafc9a93 on 4.x
    fix: #3641211 The promotion reorder form saves weight changes without...

  • jsacksick committed 002f36bb on 3.x
    fix: #3641211 The promotion reorder form saves weight changes without...
jsacksick’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.