SecurityHandlerInterface.php 1.5 KB

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