Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OrderViewAuthorization.php
Go to the documentation of this file.
1 <?php
8 
10 
12 {
16  protected $registry;
17 
21  public function __construct(\Magento\Framework\Registry $registry)
22  {
23  $this->registry = $registry;
24  }
25 
29  public function canView(\Magento\Sales\Model\Order $order)
30  {
31  $currentOrder = $this->registry->registry('current_order');
32  if ($order->getId() && $order->getId() === $currentOrder->getId()) {
33  return true;
34  }
35  return false;
36  }
37 }
$order
Definition: order.php:55