Problem/Motivation
We have a custom order view where we list relevant information for site editors, client administrator that do not have full admin permissions. One field that is relevant for our users here is Payment Gateway information/label.
Due to missing administer commerce_payment_gateway permission those users are not able to see the payment gateway label. I am using entity_reference_label formatter to show the label.
Proposed resolution
My proposal would be to enable view label permission for Payment Gateway entities in order to cover the cases described in the above chapter.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3116643-view-label-payment-gateway-2.patch | 1.87 KB | mbovan |
Comments
Comment #2
mbovan commentedThis is a snippet I had in mind.
I am not sure whether it makes sense to introduce new permission just for the label. The administrative permission and
manage own commerce_payment_methodwork for us.Comment #3
berdirYeah, not sure about the permission to use here, but +1 on the approach, I think being able to see the gateway label is useful in a lot of cases.
Possibly a more common permission would be sufficient, or a dedicated view gateway label one if we want to be sure to not affect anything else. Lets see what @bojanz thinks :)
Comment #4
bojanz commentedI'd lean more towards reusing an existing permission, like this patch does, since I consider the payment gateway label to be non-sensitive. There's a frequent need to show it around. However, it will need to wait until after 2.17.
Comment #5
waspper commentedTested patch from #2, and it works fine for label. The only drawback is, it doesn't do the same for gateway ID. This last one could be useful for Views where we would want payment gateway ID to be used as CSS class to display an icon (theming).
Comment #6
johnpitcairn commentedFor gateway ID, does the access operation need to be "view", not "view label"? We implement
hook_commerce_payment_gateway_access()to allow viewing the rendered gateway entity in views (which just gives you the label anyway), and we use a custom permission for safety. Interestingly, that same hook doesn't appear to work to override the "view label" operation, which I would prefer.Comment #7
bakopTested patch from # 2 and it was exactly what i need. Now i can display the payment gateway field in view.
Comment #8
bakopComment #9
zambrey commented#2 works in my case as well.
Comment #11
jsacksick commentedWent ahead and committed the patch from #2, thanks everyone!