SecurityHandlerInterface.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  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 Sonata\AdminBundle\Security\Handler;
  11. use Sonata\AdminBundle\Admin\AdminInterface;
  12. /**
  13. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  14. */
  15. interface SecurityHandlerInterface
  16. {
  17. /**
  18. * @param AdminInterface $admin
  19. * @param string|array $attributes
  20. * @param null $object
  21. *
  22. * @return bool
  23. */
  24. public function isGranted(AdminInterface $admin, $attributes, $object = null);
  25. /**
  26. * Get a sprintf template to get the role.
  27. *
  28. * @param AdminInterface $admin
  29. *
  30. * @return string
  31. */
  32. public function getBaseRole(AdminInterface $admin);
  33. /**
  34. * @param AdminInterface $admin
  35. */
  36. public function buildSecurityInformation(AdminInterface $admin);
  37. /**
  38. * Create object security, fe. make the current user owner of the object.
  39. *
  40. * @param AdminInterface $admin
  41. * @param mixed $object
  42. */
  43. public function createObjectSecurity(AdminInterface $admin, $object);
  44. /**
  45. * Remove object security.
  46. *
  47. * @param AdminInterface $admin
  48. * @param mixed $object
  49. */
  50. public function deleteObjectSecurity(AdminInterface $admin, $object);
  51. }