igroupmanager.php 3.4 KB

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