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

Comments

mbovan created an issue. See original summary.

mbovan’s picture

Status: Active » Needs review
StatusFileSize
new1.87 KB

This 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_method work for us.

berdir’s picture

Yeah, 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 :)

bojanz’s picture

I'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.

waspper’s picture

Tested 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).

johnpitcairn’s picture

For 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.

bakop’s picture

Tested patch from # 2 and it was exactly what i need. Now i can display the payment gateway field in view.

bakop’s picture

Status: Needs review » Reviewed & tested by the community
zambrey’s picture

#2 works in my case as well.

  • jsacksick committed 75dcf0c on 8.x-2.x authored by mbovan
    Issue #3116643 by mbovan, bojanz, Berdir: Allow "view label" permission...
jsacksick’s picture

Status: Reviewed & tested by the community » Fixed

Went ahead and committed the patch from #2, thanks everyone!

  • jsacksick committed 5ed7a78 on 3.0.x authored by mbovan
    Issue #3116643 by mbovan, bojanz, Berdir: Allow "view label" permission...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.