Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Delete action for edit product does not look to check permission via the Elements service to determine whether the delete button is shown in the cp #3285

Closed
samhibberd opened this issue Sep 29, 2023 · 5 comments
Labels
bug commerce4 Issues related to Commerce v4

Comments

@samhibberd
Copy link

What happened?

Description

Screenshot 2023-09-29 at 11 12 57

Steps to reproduce

Hooked into Elements service EVENT_AUTHORIZE_DELETE and set$e->authorized = false;
Event::on(Elements::class, Elements::EVENT_AUTHORIZE_DELETE, [ElementsHandler::class, 'authorizeDelete']);

Expected behavior

Delete button is hidden from the cp action menu

Actual behavior

Delete button is not hidden from the cp action menu

PS: Works as expected with craft elements eg Entries, Categories
PPS: It does correctly enforce the permission when hitting delete

Craft CMS version

4.5.6.1

Craft Commerce version

4.3.0

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@samhibberd samhibberd added commerce4 Issues related to Commerce v4 bug labels Sep 29, 2023
@lukeholder
Copy link
Member

lukeholder commented Sep 30, 2023

Thanks. Fixed for the next release.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "dev-develop#b2d5f6d2b3eaa5f31abd2e05748b4f3681667c84",
  "...": "..."
}

Then run composer update.

@lukeholder
Copy link
Member

@samhibberd good catch on using the service. Will fix.

@lukeholder
Copy link
Member

Updated the fix to use the service. Updated to commit b2d5f6d in the composer guide above.

@samhibberd
Copy link
Author

Thanks @lukeholder

@nfourtythree
Copy link
Contributor

Commerce 4.3.1 has now been released with these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4
Projects
None yet
Development

No branches or pull requests

3 participants