IGroupManager.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  8. * @author Lukas Reschke <lukas@statuscode.ch>
  9. * @author Morris Jobke <hey@morrisjobke.de>
  10. * @author Robin Appelman <robin@icewind.nl>
  11. * @author Thomas Müller <thomas.mueller@tmit.eu>
  12. * @author Vinicius Cubas Brand <vinicius@eita.org.br>
  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. * Class Manager
  32. *
  33. * Hooks available in scope \OC\Group:
  34. * - preAddUser(\OC\Group\Group $group, \OC\User\User $user)
  35. * - postAddUser(\OC\Group\Group $group, \OC\User\User $user)
  36. * - preRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
  37. * - postRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
  38. * - preDelete(\OC\Group\Group $group)
  39. * - postDelete(\OC\Group\Group $group)
  40. * - preCreate(string $groupId)
  41. * - postCreate(\OC\Group\Group $group)
  42. *
  43. * @package OC\Group
  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
  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
  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. }