- 🇨🇭Switzerland Lukas von Blarer
I have the same issue. @kaszarobert did you come up with a solution for this?
- 🇸🇰Slovakia kaszarobert
Not 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.
- First commit to issue fork.
- Merge request !249Issue #3278337: Provide own permission and access check for product attributes → (Open) created by tbkot
- 🇺🇦Ukraine tbkot
Patch with changes from MR. To add access for users to translate product attributes add the "Translate product attribute" permission
- Status changed to Needs review
7 months ago 6:17pm 23 April 2024 - Status changed to Needs work
7 months ago 7:28am 25 April 2024 - 🇮🇱Israel jsacksick
-
+++ b/modules/product/commerce_product.module @@ -377,3 +377,27 @@ function commerce_product_field_group_content_element_keys_alter(&$keys) { +function commerce_product_entity_operation_alter(array &$operations, EntityInterface $entity): void {
Do we really need this? Isn't the access automatically checked for the route?
-
+++ b/modules/product/commerce_product.module @@ -377,3 +377,27 @@ function commerce_product_field_group_content_element_keys_alter(&$keys) { + // operation is not exist we need to check if the user has access to manage
is not exist -> does not exist.
-
+++ b/modules/product/commerce_product.permissions.yml @@ -2,3 +2,8 @@ +'translate product attribute':
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.
-
+++ b/modules/product/src/ConfigTranslation/ProductAttributeMapper.php @@ -24,7 +26,42 @@ class ProductAttributeMapper extends ConfigEntityMapper { + private function addTranslationFormAccessCheck(Route &$route): void {
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 :).
-
- Status changed to Needs review
7 months ago 6:24pm 25 April 2024 - 🇺🇦Ukraine tbkot
@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 -
jsacksick →
committed 12720cd0 on 8.x-2.x authored by
tBKoT →
Issue #3278337 by tBKoT, kaszarobert, Lukas von Blarer, jsacksick:...
-
jsacksick →
committed 12720cd0 on 8.x-2.x authored by
tBKoT →
-
jsacksick →
committed bb9467fb on 3.0.x authored by
tBKoT →
Issue #3278337 by tBKoT, kaszarobert, Lukas von Blarer, jsacksick:...
-
jsacksick →
committed bb9467fb on 3.0.x authored by
tBKoT →
- Status changed to Fixed
7 months ago 2:59pm 9 May 2024 Automatically closed - issue fixed for 2 weeks with no activity.