UrlGenerator.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model\Order\Grid\Row;
  7. /**
  8. * Sales orders grid row url generator
  9. */
  10. class UrlGenerator extends \Magento\Backend\Model\Widget\Grid\Row\UrlGenerator
  11. {
  12. /**
  13. * @var \Magento\Framework\AuthorizationInterface
  14. */
  15. protected $_authorization;
  16. /**
  17. * @param \Magento\Backend\Model\UrlInterface $backendUrl
  18. * @param \Magento\Framework\AuthorizationInterface $authorization
  19. * @param array $args
  20. */
  21. public function __construct(
  22. \Magento\Backend\Model\UrlInterface $backendUrl,
  23. \Magento\Framework\AuthorizationInterface $authorization,
  24. array $args = []
  25. ) {
  26. $this->_authorization = $authorization;
  27. parent::__construct($backendUrl, $args);
  28. }
  29. /**
  30. * Generate row url
  31. * @param \Magento\Framework\DataObject $item
  32. * @return bool|string
  33. */
  34. public function getUrl($item)
  35. {
  36. if ($this->_authorization->isAllowed('Magento_Sales::actions_view')) {
  37. return parent::getUrl($item);
  38. }
  39. return false;
  40. }
  41. }