1
0

GroupInterface.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  8. * @author Knut Ahlers <knut@ahlers.me>
  9. * @author Morris Jobke <hey@morrisjobke.de>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. * @author Vincent Petry <vincent@nextcloud.com>
  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. // use OCP namespace for all classes that are considered public.
  29. // This means that they should be used by apps instead of the internal ownCloud classes
  30. namespace OCP;
  31. /**
  32. * TODO actually this is a IGroupBackend
  33. *
  34. * @since 4.5.0
  35. */
  36. interface GroupInterface {
  37. /**
  38. * actions that user backends can define
  39. *
  40. * @since 12.0.0
  41. */
  42. public const CREATE_GROUP = 0x00000001;
  43. /**
  44. * @since 12.0.0
  45. */
  46. public const DELETE_GROUP = 0x00000010;
  47. /**
  48. * @since 12.0.0
  49. */
  50. public const ADD_TO_GROUP = 0x00000100;
  51. /**
  52. * @since 12.0.0
  53. * @deprecated 29.0.0
  54. */
  55. public const REMOVE_FROM_GOUP = 0x00001000; // oops
  56. /**
  57. * @since 12.0.0
  58. */
  59. public const REMOVE_FROM_GROUP = 0x00001000;
  60. //OBSOLETE const GET_DISPLAYNAME = 0x00010000;
  61. /**
  62. * @since 12.0.0
  63. */
  64. public const COUNT_USERS = 0x00100000;
  65. /**
  66. * @since 12.0.0
  67. */
  68. public const GROUP_DETAILS = 0x01000000;
  69. /**
  70. * @since 13.0.0
  71. */
  72. public const IS_ADMIN = 0x10000000;
  73. /**
  74. * Check if backend implements actions
  75. * @param int $actions bitwise-or'ed actions
  76. * @return boolean
  77. * @since 4.5.0
  78. *
  79. * Returns the supported actions as int to be
  80. * compared with \OC_Group_Backend::CREATE_GROUP etc.
  81. */
  82. public function implementsActions($actions);
  83. /**
  84. * is user in group?
  85. * @param string $uid uid of the user
  86. * @param string $gid gid of the group
  87. * @return bool
  88. * @since 4.5.0
  89. *
  90. * Checks whether the user is member of a group or not.
  91. */
  92. public function inGroup($uid, $gid);
  93. /**
  94. * Get all groups a user belongs to
  95. * @param string $uid Name of the user
  96. * @return array an array of group names
  97. * @since 4.5.0
  98. *
  99. * This function fetches all groups a user belongs to. It does not check
  100. * if the user exists at all.
  101. */
  102. public function getUserGroups($uid);
  103. /**
  104. * @brief Get a list of all groups
  105. *
  106. * @param string $search
  107. * @param int $limit
  108. * @param int $offset
  109. * @return array an array of group names
  110. * @since 4.5.0
  111. *
  112. * Returns a list with all groups
  113. */
  114. public function getGroups(string $search = '', int $limit = -1, int $offset = 0);
  115. /**
  116. * @brief Check if a group exists
  117. *
  118. * @param string $gid
  119. * @return bool
  120. * @since 4.5.0
  121. */
  122. public function groupExists($gid);
  123. /**
  124. * @brief Get a list of user ids in a group matching the given search parameters.
  125. *
  126. * @param string $gid
  127. * @param string $search
  128. * @param int $limit
  129. * @param int $offset
  130. * @return array<int,string> an array of user ids
  131. * @since 4.5.0
  132. * @deprecated 27.0.0 Use searchInGroup instead, for performance reasons
  133. */
  134. public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
  135. }