Acl.php 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework;
  7. /**
  8. * ACL. Can be queried for relations between roles and resources.
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Acl extends \Zend_Acl
  14. {
  15. /**
  16. * Permission level to deny access
  17. */
  18. const RULE_PERM_DENY = 0;
  19. /**
  20. * Permission level to inherit access from parent role
  21. */
  22. const RULE_PERM_INHERIT = 1;
  23. /**
  24. * Permission level to allow access
  25. */
  26. const RULE_PERM_ALLOW = 2;
  27. /**
  28. * Constructor
  29. */
  30. public function __construct()
  31. {
  32. $this->_roleRegistry = new \Magento\Framework\Acl\Role\Registry();
  33. }
  34. /**
  35. * Add parent to role object
  36. *
  37. * @param \Zend_Acl_Role $role
  38. * @param \Zend_Acl_Role $parent
  39. * @return \Magento\Framework\Acl
  40. */
  41. public function addRoleParent($role, $parent)
  42. {
  43. $this->_getRoleRegistry()->addParent($role, $parent);
  44. return $this;
  45. }
  46. }