FieldEntry.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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\Domain;
  11. use Symfony\Component\Security\Acl\Model\AclInterface;
  12. use Symfony\Component\Security\Acl\Model\FieldEntryInterface;
  13. use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;
  14. /**
  15. * Field-aware ACE implementation which is auditable.
  16. *
  17. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  18. */
  19. class FieldEntry extends Entry implements FieldEntryInterface
  20. {
  21. private $field;
  22. /**
  23. * Constructor.
  24. *
  25. * @param int $id
  26. * @param AclInterface $acl
  27. * @param string $field
  28. * @param SecurityIdentityInterface $sid
  29. * @param string $strategy
  30. * @param int $mask
  31. * @param bool $granting
  32. * @param bool $auditFailure
  33. * @param bool $auditSuccess
  34. */
  35. public function __construct($id, AclInterface $acl, $field, SecurityIdentityInterface $sid, $strategy, $mask, $granting, $auditFailure, $auditSuccess)
  36. {
  37. parent::__construct($id, $acl, $sid, $strategy, $mask, $granting, $auditFailure, $auditSuccess);
  38. $this->field = $field;
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function getField()
  44. {
  45. return $this->field;
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function serialize()
  51. {
  52. return serialize(array(
  53. $this->field,
  54. parent::serialize(),
  55. ));
  56. }
  57. /**
  58. * {@inheritdoc}
  59. */
  60. public function unserialize($serialized)
  61. {
  62. list($this->field, $parentStr) = unserialize($serialized);
  63. parent::unserialize($parentStr);
  64. }
  65. }