Describe your bug or feature request.
/admin/commerce/product-attributes/manage/{attribute}/translate gives 403 Access denied pages to content editors unless we give them "translate configuration" permission. Giving that permission to them is not a good solution because that way we also enable access to other translating-related core administration form pages such as /admin/config/regional/config-translation and /admin/config/regional/translate.
If a bug, provide steps to reproduce it from a clean install.
1. install commerce, so that you can create products and product attributes
2. enable the 4 Drupal Drupal core translation-related modules
3. add another language to Drupal
4. enable translations for product attributes, products, product variations
5. create a content administrator user role that
6. try to set permissions so that with this role users could be able to manage products, variations, orders and product attributes
7. create a user with that role
8. login with this user
9. try to add product attributes and translations to the product attributes.
10. instead of the attributes' translation form, you should see Access denied
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3278337-10.patch | 10.08 KB | tbkot |
Issue fork commerce-3278337
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:
- 3278337-product-attribute-translation
changes, plain diff MR !249
Comments
Comment #2
kaszarobertThe problem is that before the product attribute translation overview and form
ConfigTranslationOverviewAccess::doCheckAccess, core config_translation module checks this:I'm not sure how this could be replaced or overridden.
Comment #3
luksakI have the same issue. @kaszarobert did you come up with a solution for this?
Comment #4
kaszarobertNot really. Frankly, we didn't mess around with that and we simply gave that permission to the shop owners and told them, that they should edit only product, order, content, taxonomy forms and leave the rest of the settings pages alone, and they did that.
Comment #7
tbkot commentedPatch with changes from MR. To add access for users to translate product attributes add the "Translate product attribute" permission
Comment #8
tbkot commentedComment #9
jsacksick commentedDo we really need this? Isn't the access automatically checked for the route?
is not exist -> does not exist.
perhaps we should make this:
translate "commerce_product_attribute"
to match "administer commerce_product_attribute".
I don't really see places where we just drop the prefix.
In general, we prefer protected methods to allow for overrides in commerce core / contrib... I know it's tempting to add private methods, but... that isn't what we usually do :).
Comment #10
tbkot commented@jsacksick
1. We need to check access to the URL before adding it to the operation list, in another case users without access to this page would see the link but the page will return an access denied exception
2. Fixed
3. Permission renamed to "translate commerce_product_attribute"
4. Fixed
Comment #13
jsacksick commentedCommitted, thanks!