GroupInterface.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  4. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. *
  7. * @copyright Copyright (c) 2016, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. /**
  24. * Public interface of ownCloud for apps to use.
  25. * Group Class.
  26. *
  27. */
  28. // use OCP namespace for all classes that are considered public.
  29. // This means that they should be used by apps instead of the internal ownCloud classes
  30. namespace OCP;
  31. /**
  32. * TODO actually this is a IGroupBackend
  33. *
  34. * @package OCP
  35. * @since 4.5.0
  36. */
  37. interface GroupInterface {
  38. /**
  39. * Check if backend implements actions
  40. * @param int $actions bitwise-or'ed actions
  41. * @return boolean
  42. * @since 4.5.0
  43. *
  44. * Returns the supported actions as int to be
  45. * compared with \OC_Group_Backend::CREATE_GROUP etc.
  46. */
  47. public function implementsActions($actions);
  48. /**
  49. * is user in group?
  50. * @param string $uid uid of the user
  51. * @param string $gid gid of the group
  52. * @return bool
  53. * @since 4.5.0
  54. *
  55. * Checks whether the user is member of a group or not.
  56. */
  57. public function inGroup($uid, $gid);
  58. /**
  59. * Get all groups a user belongs to
  60. * @param string $uid Name of the user
  61. * @return array an array of group names
  62. * @since 4.5.0
  63. *
  64. * This function fetches all groups a user belongs to. It does not check
  65. * if the user exists at all.
  66. */
  67. public function getUserGroups($uid);
  68. /**
  69. * get a list of all groups
  70. * @param string $search
  71. * @param int $limit
  72. * @param int $offset
  73. * @return array an array of group names
  74. * @since 4.5.0
  75. *
  76. * Returns a list with all groups
  77. */
  78. public function getGroups($search = '', $limit = -1, $offset = 0);
  79. /**
  80. * check if a group exists
  81. * @param string $gid
  82. * @return bool
  83. * @since 4.5.0
  84. */
  85. public function groupExists($gid);
  86. /**
  87. * get a list of all users in a group
  88. * @param string $gid
  89. * @param string $search
  90. * @param int $limit
  91. * @param int $offset
  92. * @return array an array of user ids
  93. * @since 4.5.0
  94. */
  95. public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
  96. }