Denied.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Backend\Block;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class Denied extends \Magento\Backend\Block\Template
  12. {
  13. /**
  14. * @var \Magento\Backend\Model\Auth\Session
  15. */
  16. protected $_authSession;
  17. /**
  18. * @param \Magento\Backend\Block\Template\Context $context
  19. * @param \Magento\Backend\Model\Auth\Session $authSession
  20. * @param array $data
  21. */
  22. public function __construct(
  23. \Magento\Backend\Block\Template\Context $context,
  24. \Magento\Backend\Model\Auth\Session $authSession,
  25. array $data = []
  26. ) {
  27. $this->_authSession = $authSession;
  28. parent::__construct($context, $data);
  29. }
  30. /**
  31. * @return bool
  32. */
  33. public function hasAvailableResources()
  34. {
  35. $user = $this->_authSession->getUser();
  36. if ($user && $user->getHasAvailableResources()) {
  37. return true;
  38. }
  39. return false;
  40. }
  41. }