IGroup.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Johannes Leuker <j.leuker@hosting.de>
  7. * @author John Molakvoæ <skjnldsv@protonmail.com>
  8. * @author Julius Härtl <jus@bitgrid.net>
  9. * @author Lukas Reschke <lukas@statuscode.ch>
  10. * @author Morris Jobke <hey@morrisjobke.de>
  11. * @author Robin Appelman <robin@icewind.nl>
  12. * @author Vincent Petry <vincent@nextcloud.com>
  13. *
  14. * @license AGPL-3.0
  15. *
  16. * This code is free software: you can redistribute it and/or modify
  17. * it under the terms of the GNU Affero General Public License, version 3,
  18. * as published by the Free Software Foundation.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU Affero General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU Affero General Public License, version 3,
  26. * along with this program. If not, see <http://www.gnu.org/licenses/>
  27. *
  28. */
  29. namespace OCP;
  30. /**
  31. * Interface IGroup
  32. *
  33. * @since 8.0.0
  34. */
  35. interface IGroup {
  36. /**
  37. * @return string
  38. * @since 8.0.0
  39. */
  40. public function getGID();
  41. /**
  42. * Returns the group display name
  43. *
  44. * @return string
  45. * @since 12.0.0
  46. */
  47. public function getDisplayName();
  48. /**
  49. * Set the group display name
  50. *
  51. * @param string $displayName
  52. * @return bool
  53. * @since 18.0.0
  54. */
  55. public function setDisplayName(string $displayName): bool;
  56. /**
  57. * get all users in the group
  58. *
  59. * @return \OCP\IUser[]
  60. * @since 8.0.0
  61. */
  62. public function getUsers();
  63. /**
  64. * check if a user is in the group
  65. *
  66. * @param \OCP\IUser $user
  67. * @return bool
  68. * @since 8.0.0
  69. */
  70. public function inGroup(IUser $user);
  71. /**
  72. * add a user to the group
  73. *
  74. * @param \OCP\IUser $user
  75. * @since 8.0.0
  76. */
  77. public function addUser(IUser $user);
  78. /**
  79. * remove a user from the group
  80. *
  81. * @param \OCP\IUser $user
  82. * @since 8.0.0
  83. */
  84. public function removeUser($user);
  85. /**
  86. * search for users in the group by userid
  87. *
  88. * @param string $search
  89. * @param int $limit
  90. * @param int $offset
  91. * @return \OCP\IUser[]
  92. * @since 8.0.0
  93. */
  94. public function searchUsers(string $search, ?int $limit = null, ?int $offset = null): array;
  95. /**
  96. * returns the number of users matching the search string
  97. *
  98. * @param string $search
  99. * @return int|bool
  100. * @since 8.0.0
  101. */
  102. public function count($search = '');
  103. /**
  104. * returns the number of disabled users
  105. *
  106. * @return int|bool
  107. * @since 14.0.0
  108. */
  109. public function countDisabled();
  110. /**
  111. * search for users in the group by displayname
  112. *
  113. * @param string $search
  114. * @param int $limit
  115. * @param int $offset
  116. * @return \OCP\IUser[]
  117. * @since 8.0.0
  118. */
  119. public function searchDisplayName($search, $limit = null, $offset = null);
  120. /**
  121. * Get the names of the backends the group is connected to
  122. *
  123. * @return string[]
  124. * @since 22.0.0
  125. */
  126. public function getBackendNames();
  127. /**
  128. * delete the group
  129. *
  130. * @return bool
  131. * @since 8.0.0
  132. */
  133. public function delete();
  134. /**
  135. * @return bool
  136. * @since 14.0.0
  137. */
  138. public function canRemoveUser();
  139. /**
  140. * @return bool
  141. * @since 14.0.0
  142. */
  143. public function canAddUser();
  144. /**
  145. * @return bool
  146. * @since 16.0.0
  147. */
  148. public function hideFromCollaboration(): bool;
  149. }