Skip to content

Check the registered inventory transfer permission - #4399

Merged
lukeholder merged 1 commit into
5.xfrom
bugfix/transfer-permission
Oct 30, 2026
Merged

lukeholder merged 1 commit into
5.xfrom
bugfix/transfer-permission

Conversation

@brandonkelly

Copy link
Copy Markdown
Member

Summary

Transfer::canView(), canSave(), and canDelete() checked commerce-manageTransfers, but the permission Commerce registers (and TransfersController requires) is commerce-manageInventoryTransfers.

Only users who already had “Manage inventory transfers” when m240815_035618_fix_transfer_permission ran (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 only commerce-manageInventoryTransfers can view, save, and delete a draft transfer, and a user without it can't. On unchanged 5.x it fails (Failed asserting that false is true. at the canView() assertion). With the fix, it passes.

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
@brandonkelly
brandonkelly requested a review from a team as a code owner October 29, 2026 13:52
@lukeholder
lukeholder merged commit d4cc10f into 5.x Oct 30, 2026
14 checks passed
@lukeholder
lukeholder deleted the bugfix/transfer-permission branch October 30, 2026 02:14
@lukeholder

Copy link
Copy Markdown
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants