IGroupManager.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. *
  13. * @license AGPL-3.0
  14. *
  15. * This code is free software: you can redistribute it and/or modify
  16. * it under the terms of the GNU Affero General Public License, version 3,
  17. * as published by the Free Software Foundation.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU Affero General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Affero General Public License, version 3,
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>
  26. *
  27. */
  28. namespace OCP;
  29. /**
  30. * Class Manager
  31. *
  32. * Hooks available in scope \OC\Group:
  33. * - preAddUser(\OC\Group\Group $group, \OC\User\User $user)
  34. * - postAddUser(\OC\Group\Group $group, \OC\User\User $user)
  35. * - preRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
  36. * - postRemoveUser(\OC\Group\Group $group, \OC\User\User $user)
  37. * - preDelete(\OC\Group\Group $group)
  38. * - postDelete(\OC\Group\Group $group)
  39. * - preCreate(string $groupId)
  40. * - postCreate(\OC\Group\Group $group)
  41. *
  42. * @package OC\Group
  43. * @since 8.0.0
  44. */
  45. interface IGroupManager {
  46. /**
  47. * Checks whether a given backend is used
  48. *
  49. * @param string $backendClass Full classname including complete namespace
  50. * @return bool
  51. * @since 8.1.0
  52. */
  53. public function isBackendUsed($backendClass);
  54. /**
  55. * @param \OCP\GroupInterface $backend
  56. * @since 8.0.0
  57. */
  58. public function addBackend($backend);
  59. /**
  60. * @since 8.0.0
  61. */
  62. public function clearBackends();
  63. /**
  64. * @param string $gid
  65. * @return \OCP\IGroup
  66. * @since 8.0.0
  67. */
  68. public function get($gid);
  69. /**
  70. * @param string $gid
  71. * @return bool
  72. * @since 8.0.0
  73. */
  74. public function groupExists($gid);
  75. /**
  76. * @param string $gid
  77. * @return \OCP\IGroup
  78. * @since 8.0.0
  79. */
  80. public function createGroup($gid);
  81. /**
  82. * @param string $search
  83. * @param int $limit
  84. * @param int $offset
  85. * @return \OCP\IGroup[]
  86. * @since 8.0.0
  87. */
  88. public function search($search, $limit = null, $offset = null);
  89. /**
  90. * @param \OCP\IUser|null $user
  91. * @return \OCP\IGroup[]
  92. * @since 8.0.0
  93. */
  94. public function getUserGroups($user);
  95. /**
  96. * @param \OCP\IUser $user
  97. * @return array with group names
  98. * @since 8.0.0
  99. */
  100. public function getUserGroupIds($user);
  101. /**
  102. * get a list of all display names in a group
  103. *
  104. * @param string $gid
  105. * @param string $search
  106. * @param int $limit
  107. * @param int $offset
  108. * @return array an array of display names (value) and user ids (key)
  109. * @since 8.0.0
  110. */
  111. public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0);
  112. /**
  113. * Checks if a userId is in the admin group
  114. * @param string $userId
  115. * @return bool if admin
  116. * @since 8.0.0
  117. */
  118. public function isAdmin($userId);
  119. /**
  120. * Checks if a userId is in a group
  121. * @param string $userId
  122. * @param string $group
  123. * @return bool if in group
  124. * @since 8.0.0
  125. */
  126. public function isInGroup($userId, $group);
  127. }