SecurityHandlerInterface.php 1.6 KB

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