AccessRegistryInterface.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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\Admin;
  11. /**
  12. * Tells if the current user has access to a given action.
  13. *
  14. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  15. */
  16. interface AccessRegistryInterface
  17. {
  18. /**
  19. * Return the controller access mapping.
  20. *
  21. * @return array
  22. */
  23. public function getAccessMapping();
  24. /**
  25. * Hook to handle access authorization.
  26. *
  27. * @param string $action
  28. * @param object $object
  29. */
  30. public function checkAccess($action, $object = null);
  31. /*
  32. * Hook to handle access authorization, without throwing an exception.
  33. *
  34. * @param string $action
  35. * @param object $object
  36. *
  37. * @return bool
  38. * TODO: uncomment this method for next major release
  39. */
  40. // public function hasAccess($action, $object = null);
  41. }