You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
3.6 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  9. * @author Lukas Reschke <lukas@statuscode.ch>
  10. * @author Morris Jobke <hey@morrisjobke.de>
  11. * @author Robin Appelman <robin@icewind.nl>
  12. * @author Thomas Müller <thomas.mueller@tmit.eu>
  13. * @author Vinicius Cubas Brand <vinicius@eita.org.br>
  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. * Class Manager
  33. *
  34. * Hooks available in scope \OC\Group:
  35. * - preAddUser(\OC\Group\Group $group, \OC\User\User $user)
  36. * - postAddUser(\OC\Group\Group $group, \OC\User\User $user)
  37. * - preRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
  38. * - postRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
  39. * - preDelete(\OC\Group\Group $group)
  40. * - postDelete(\OC\Group\Group $group)
  41. * - preCreate(string $groupId)
  42. * - postCreate(\OC\Group\Group $group)
  43. *
  44. * @since 8.0.0
  45. */
  46. interface IGroupManager {
  47. /**
  48. * Checks whether a given backend is used
  49. *
  50. * @param string $backendClass Full classname including complete namespace
  51. * @return bool
  52. * @since 8.1.0
  53. */
  54. public function isBackendUsed($backendClass);
  55. /**
  56. * @param \OCP\GroupInterface $backend
  57. * @since 8.0.0
  58. */
  59. public function addBackend($backend);
  60. /**
  61. * @since 8.0.0
  62. */
  63. public function clearBackends();
  64. /**
  65. * Get the active backends
  66. * @return \OCP\GroupInterface[]
  67. * @since 13.0.0
  68. */
  69. public function getBackends();
  70. /**
  71. * @param string $gid
  72. * @return \OCP\IGroup|null
  73. * @since 8.0.0
  74. */
  75. public function get($gid);
  76. /**
  77. * @param string $gid
  78. * @return bool
  79. * @since 8.0.0
  80. */
  81. public function groupExists($gid);
  82. /**
  83. * @param string $gid
  84. * @return \OCP\IGroup|null
  85. * @since 8.0.0
  86. */
  87. public function createGroup($gid);
  88. /**
  89. * @param string $search
  90. * @param int $limit
  91. * @param int $offset
  92. * @return \OCP\IGroup[]
  93. * @since 8.0.0
  94. */
  95. public function search($search, $limit = null, $offset = null);
  96. /**
  97. * @param \OCP\IUser|null $user
  98. * @return \OCP\IGroup[]
  99. * @since 8.0.0
  100. */
  101. public function getUserGroups(IUser $user = null);
  102. /**
  103. * @param \OCP\IUser $user
  104. * @return array with group names
  105. * @since 8.0.0
  106. */
  107. public function getUserGroupIds(IUser $user);
  108. /**
  109. * get a list of all display names in a group
  110. *
  111. * @param string $gid
  112. * @param string $search
  113. * @param int $limit
  114. * @param int $offset
  115. * @return array an array of display names (value) and user ids (key)
  116. * @since 8.0.0
  117. */
  118. public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0);
  119. /**
  120. * Checks if a userId is in the admin group
  121. * @param string $userId
  122. * @return bool if admin
  123. * @since 8.0.0
  124. */
  125. public function isAdmin($userId);
  126. /**
  127. * Checks if a userId is in a group
  128. * @param string $userId
  129. * @param string $group
  130. * @return bool if in group
  131. * @since 8.0.0
  132. */
  133. public function isInGroup($userId, $group);
  134. }