Repository navigation
Check the registered inventory transfer permission - #4399
Merged
Merged
Conversation
Transfer::canView(), canSave(), and canDelete() checked `commerce-manageTransfers`, but the registered permission (also checked by TransfersController) is `commerce-manageInventoryTransfers`. Only users who had the permission before the m240815_035618_fix_transfer_permission migration had both. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1850a-a3a4-7642-a937-0ac503e1d04d
Member
|
Thanks! |
brandonkelly
added a commit
that referenced
this pull request
Oct 30, 2026
It shipped via 5.x (#4399), so it's already in CHANGELOG.md. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1850a-a3a4-7642-a937-0ac503e1d04d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Transfer::canView(),canSave(), andcanDelete()checkedcommerce-manageTransfers, but the permission Commerce registers (andTransfersControllerrequires) iscommerce-manageInventoryTransfers.Only users who already had “Manage inventory transfers” when
m240815_035618_fix_transfer_permissionran (Commerce 5.1) were given both permissions. Anyone granted it since then gets into the Transfers screen but fails element authorization. These methods now check the registered permission.Found while adding authenticated GraphQL support for transfers in #4397, which includes the same fix.
Evidence
tests/unit/elements/transfer/TransferTest.php: a user with onlycommerce-manageInventoryTransferscan view, save, and delete a draft transfer, and a user without it can't. On unchanged5.xit fails (Failed asserting that false is true.at thecanView()assertion). With the fix, it passes.