Plugin.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\AsynchronousOperations\Ui\Component\AdminNotification;
  7. /**
  8. * Class Plugin to eliminate Bulk related links in the notification area
  9. */
  10. class Plugin
  11. {
  12. /**
  13. * @var \Magento\Framework\AuthorizationInterface
  14. */
  15. private $authorization;
  16. /**
  17. * @var bool
  18. */
  19. private $isAllowed;
  20. /**
  21. * Plugin constructor.
  22. * @param \Magento\Framework\AuthorizationInterface $authorization
  23. */
  24. public function __construct(
  25. \Magento\Framework\AuthorizationInterface $authorization
  26. ) {
  27. $this->authorization = $authorization;
  28. }
  29. /**
  30. * Prepares Meta
  31. *
  32. * @param \Magento\AdminNotification\Ui\Component\DataProvider\DataProvider $dataProvider
  33. * @param array $result
  34. * @return array
  35. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  36. */
  37. public function afterGetMeta(
  38. \Magento\AdminNotification\Ui\Component\DataProvider\DataProvider $dataProvider,
  39. $result
  40. ) {
  41. if (!isset($this->isAllowed)) {
  42. $this->isAllowed = $this->authorization->isAllowed(
  43. 'Magento_Logging::system_magento_logging_bulk_operations'
  44. );
  45. }
  46. $result['columns']['arguments']['data']['config']['isAllowed'] = $this->isAllowed;
  47. return $result;
  48. }
  49. }