igroupmanager.php 2.7 KB

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