GroupInterface.php 2.7 KB

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