SecurityHandlerInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. interface SecurityHandlerInterface
  13. {
  14. /**
  15. * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  16. * @param string|array $attributes
  17. * @param null $object
  18. *
  19. * @return bool
  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. public function createObjectSecurity(AdminInterface $admin, $object);
  41. /**
  42. * Remove object security.
  43. *
  44. * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  45. * @param mixed $object
  46. */
  47. public function deleteObjectSecurity(AdminInterface $admin, $object);
  48. }