Guest User

Untitled

a guest
Nov 24th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
  2. <plugin name="sales_order_pending" type="VendorModulePluginCustomSalesOrderGridCollection" sortOrder="100" />
  3. </type>
  4.  
  5. <?php namespace VendorMOdulePlugin;
  6.  
  7. use MagentoSalesModelResourceModelOrderGridCollection as SalesOrderGridCollection;
  8.  
  9. class CustomSalesOrderGridCollection
  10. {
  11. private $collection;
  12. protected $adminSession;
  13. protected $logger;
  14. public function __construct(
  15. SalesOrderGridCollection $collection,
  16. MagentoBackendModelAuthSession $adminSession,
  17. PsrLogLoggerInterface $logger
  18. ) {
  19.  
  20. $this->messageManager = $messageManager;
  21. $this->collection = $collection;
  22. $this->adminSession = $adminSession;
  23. $this->logger = $logger;
  24. }
  25.  
  26. public function aroundGetReport(
  27. MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory $subject,
  28. Closure $proceed,
  29. $requestName
  30. ) {
  31. $current_adminuser = $this->adminSession->getUser()->getAclRole();
  32.  
  33. if(12 == $current_adminuser){ //Choose Your admin User Role.
  34.  
  35. $result = $proceed($requestName);
  36. if ($requestName == 'sales_order_grid_data_source') {
  37. if ($result instanceof $this->collection) {
  38. $this->collection->addFieldToFilter('status', array('in' => array('pending')));
  39. }
  40.  
  41. }
  42. }
  43. return $this->collection;
  44. }
  45. }
Add Comment
Please, Sign In to add comment