SecurityHandlerInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. * Interface SecurityHandlerInterface.
  14. *
  15. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  16. */
  17. interface SecurityHandlerInterface
  18. {
  19. /**
  20. * @param AdminInterface $admin
  21. * @param string|array $attributes
  22. * @param null $object
  23. *
  24. * @return bool
  25. */
  26. public function isGranted(AdminInterface $admin, $attributes, $object = null);
  27. /**
  28. * Get a sprintf template to get the role.
  29. *
  30. * @param AdminInterface $admin
  31. *
  32. * @return string
  33. */
  34. public function getBaseRole(AdminInterface $admin);
  35. /**
  36. * @param AdminInterface $admin
  37. */
  38. public function buildSecurityInformation(AdminInterface $admin);
  39. /**
  40. * Create object security, fe. make the current user owner of the object.
  41. *
  42. * @param AdminInterface $admin
  43. * @param mixed $object
  44. */
  45. public function createObjectSecurity(AdminInterface $admin, $object);
  46. /**
  47. * Remove object security.
  48. *
  49. * @param AdminInterface $admin
  50. * @param mixed $object
  51. */
  52. public function deleteObjectSecurity(AdminInterface $admin, $object);
  53. }