AclInterface.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Security\Acl\Model;
  11. use Symfony\Component\Security\Acl\Exception\NoAceFoundException;
  12. /**
  13. * This interface represents an access control list (ACL) for a domain object.
  14. * Each domain object can have exactly one associated ACL.
  15. *
  16. * An ACL contains all access control entries (ACE) for a given domain object.
  17. * In order to avoid needing references to the domain object itself, implementations
  18. * use ObjectIdentity implementations as an additional level of indirection.
  19. *
  20. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  21. */
  22. interface AclInterface extends \Serializable
  23. {
  24. /**
  25. * Returns all class-based ACEs associated with this ACL.
  26. *
  27. * @return array
  28. */
  29. public function getClassAces();
  30. /**
  31. * Returns all class-field-based ACEs associated with this ACL.
  32. *
  33. * @param string $field
  34. *
  35. * @return array
  36. */
  37. public function getClassFieldAces($field);
  38. /**
  39. * Returns all object-based ACEs associated with this ACL.
  40. *
  41. * @return array
  42. */
  43. public function getObjectAces();
  44. /**
  45. * Returns all object-field-based ACEs associated with this ACL.
  46. *
  47. * @param string $field
  48. *
  49. * @return array
  50. */
  51. public function getObjectFieldAces($field);
  52. /**
  53. * Returns the object identity associated with this ACL.
  54. *
  55. * @return ObjectIdentityInterface
  56. */
  57. public function getObjectIdentity();
  58. /**
  59. * Returns the parent ACL, or null if there is none.
  60. *
  61. * @return AclInterface|null
  62. */
  63. public function getParentAcl();
  64. /**
  65. * Whether this ACL is inheriting ACEs from a parent ACL.
  66. *
  67. * @return bool
  68. */
  69. public function isEntriesInheriting();
  70. /**
  71. * Determines whether field access is granted.
  72. *
  73. * @param string $field
  74. * @param array $masks
  75. * @param array $securityIdentities
  76. * @param bool $administrativeMode
  77. *
  78. * @return bool
  79. */
  80. public function isFieldGranted($field, array $masks, array $securityIdentities, $administrativeMode = false);
  81. /**
  82. * Determines whether access is granted.
  83. *
  84. * @param array $masks
  85. * @param array $securityIdentities
  86. * @param bool $administrativeMode
  87. *
  88. * @throws NoAceFoundException when no ACE was applicable for this request
  89. *
  90. * @return bool
  91. */
  92. public function isGranted(array $masks, array $securityIdentities, $administrativeMode = false);
  93. /**
  94. * Whether the ACL has loaded ACEs for all of the passed security identities.
  95. *
  96. * @param mixed $securityIdentities an implementation of SecurityIdentityInterface, or an array thereof
  97. *
  98. * @return bool
  99. */
  100. public function isSidLoaded($securityIdentities);
  101. }