GroupableInterface.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. * This file is part of the FOSUserBundle package.
  4. *
  5. * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  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 FOS\UserBundle\Model;
  11. /**
  12. * @author Thibault Duplessis <thibault.duplessis@gmail.com>
  13. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  14. * @author Christophe Coevoet <stof@notk.org>
  15. */
  16. interface GroupableInterface
  17. {
  18. /**
  19. * Gets the groups granted to the user.
  20. *
  21. * @return \Traversable
  22. */
  23. public function getGroups();
  24. /**
  25. * Gets the name of the groups which includes the user.
  26. *
  27. * @return array
  28. */
  29. public function getGroupNames();
  30. /**
  31. * Indicates whether the user belongs to the specified group or not.
  32. *
  33. * @param string $name Name of the group
  34. *
  35. * @return Boolean
  36. */
  37. public function hasGroup($name);
  38. /**
  39. * Add a group to the user groups.
  40. *
  41. * @param GroupInterface $group
  42. *
  43. * @return self
  44. */
  45. public function addGroup(GroupInterface $group);
  46. /**
  47. * Remove a group from the user groups.
  48. *
  49. * @param GroupInterface $group
  50. *
  51. * @return self
  52. */
  53. public function removeGroup(GroupInterface $group);
  54. }