SecurityHandlerInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. 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. function getBaseRole(AdminInterface $admin);
  30. /**
  31. * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  32. *
  33. * @return void
  34. */
  35. function buildSecurityInformation(AdminInterface $admin);
  36. /**
  37. * Create object security, fe. make the current user owner of the object
  38. *
  39. * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  40. * @param mixed $object
  41. *
  42. * @return void
  43. */
  44. function createObjectSecurity(AdminInterface $admin, $object);
  45. /**
  46. * Remove object security
  47. *
  48. * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  49. * @param mixed $object
  50. *
  51. * @return void
  52. */
  53. function deleteObjectSecurity(AdminInterface $admin, $object);
  54. }