ItemsUpdater.php 995 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Indexer\Block\Backend\Grid;
  7. class ItemsUpdater implements \Magento\Framework\View\Layout\Argument\UpdaterInterface
  8. {
  9. /**
  10. * @var \Magento\Framework\AuthorizationInterface
  11. */
  12. protected $authorization;
  13. /**
  14. * @param \Magento\Framework\AuthorizationInterface $authorization
  15. */
  16. public function __construct(\Magento\Framework\AuthorizationInterface $authorization)
  17. {
  18. $this->authorization = $authorization;
  19. }
  20. /**
  21. * Remove massaction items in case they disallowed for user
  22. * @param mixed $argument
  23. * @return mixed
  24. */
  25. public function update($argument)
  26. {
  27. if (false === $this->authorization->isAllowed('Magento_Indexer::changeMode')) {
  28. unset($argument['change_mode_onthefly']);
  29. unset($argument['change_mode_changelog']);
  30. }
  31. return $argument;
  32. }
  33. }