1
0

IGroup.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OCP;
  9. /**
  10. * Interface IGroup
  11. *
  12. * @since 8.0.0
  13. */
  14. interface IGroup {
  15. /**
  16. * @return string
  17. * @since 8.0.0
  18. */
  19. public function getGID(): string;
  20. /**
  21. * Returns the group display name
  22. *
  23. * @return string
  24. * @since 12.0.0
  25. */
  26. public function getDisplayName(): string;
  27. /**
  28. * Set the group display name
  29. *
  30. * @param string $displayName
  31. * @return bool
  32. * @since 18.0.0
  33. */
  34. public function setDisplayName(string $displayName): bool;
  35. /**
  36. * get all users in the group
  37. *
  38. * @return IUser[]
  39. * @since 8.0.0
  40. */
  41. public function getUsers(): array;
  42. /**
  43. * check if a user is in the group
  44. *
  45. * @param IUser $user
  46. *
  47. * @return bool
  48. * @since 8.0.0
  49. */
  50. public function inGroup(IUser $user): bool;
  51. /**
  52. * add a user to the group
  53. *
  54. * @param IUser $user
  55. *
  56. * @since 8.0.0
  57. */
  58. public function addUser(IUser $user): void;
  59. /**
  60. * Remove a user from the group
  61. *
  62. * @param IUser $user
  63. *
  64. * @since 8.0.0
  65. */
  66. public function removeUser(IUser $user): void;
  67. /**
  68. * search for users in the group by userid
  69. *
  70. * @param string $search
  71. * @param int|null $limit
  72. * @param int|null $offset
  73. *
  74. * @return IUser[]
  75. * @since 8.0.0
  76. */
  77. public function searchUsers(string $search, ?int $limit = null, ?int $offset = null): array;
  78. /**
  79. * returns the number of users matching the search string
  80. *
  81. * @param string $search
  82. * @return int|bool
  83. * @since 8.0.0
  84. */
  85. public function count(string $search = ''): int|bool;
  86. /**
  87. * returns the number of disabled users
  88. *
  89. * @return int|bool
  90. * @since 14.0.0
  91. */
  92. public function countDisabled(): int|bool;
  93. /**
  94. * Search for users in the group by displayname
  95. *
  96. * @param string $search
  97. * @param int|null $limit
  98. * @param int|null $offset
  99. *
  100. * @return IUser[]
  101. * @since 8.0.0
  102. */
  103. public function searchDisplayName(string $search, ?int $limit = null, ?int $offset = null): array;
  104. /**
  105. * Get the names of the backends the group is connected to
  106. *
  107. * @return string[]
  108. * @since 22.0.0
  109. */
  110. public function getBackendNames(): array;
  111. /**
  112. * Delete the group
  113. *
  114. * @return bool
  115. * @since 8.0.0
  116. */
  117. public function delete(): bool;
  118. /**
  119. * @return bool
  120. * @since 14.0.0
  121. */
  122. public function canRemoveUser(): bool;
  123. /**
  124. * @return bool
  125. * @since 14.0.0
  126. */
  127. public function canAddUser(): bool;
  128. /**
  129. * @return bool
  130. * @since 16.0.0
  131. */
  132. public function hideFromCollaboration(): bool;
  133. }