For shop administrators (non site admins) the order status column is empty on the view orders page (admin/store/orders/view).

This is because Views require a field to have an AccessResult::allowed() to show it. The access() method is not implemented yet for the uc_order_status entity type. Implementing it solves the problem.

Please review / commit patch.

Comments

bjaxelsen created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, order_status_access.patch, failed testing.

bjaxelsen’s picture

the failing test (product kit discounts) appears to be unrelated to the patch

The last submitted patch, order_status_access.patch, failed testing.

TR’s picture

Status: Needs work » Needs review
david.czinege’s picture

I tested the uploaded patch. When i wanted to see my order history with an authenticated user, i got a fatal error:

Fatal error: Call to a member function isAllowed() on null in /var/www/drupalvm/drupal/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php on line 58

You can try this if you visit for example te next page:
/user/10/orders

I rewrite the patch, and I added the view own orders permission also.

Please review it.

longwave’s picture

Status: Needs review » Needs work

I think instead we need an OrderStatusAccessControlHandler class that extends EntityAccessControlHandler and performs permission checks for view, create, update and delete.