IGroup.php 3.5 KB

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