GroupInterface.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. public const CREATE_GROUP = 0x00000001;
  41. public const DELETE_GROUP = 0x00000010;
  42. public const ADD_TO_GROUP = 0x00000100;
  43. public const REMOVE_FROM_GOUP = 0x00001000; // oops
  44. public const REMOVE_FROM_GROUP = 0x00001000;
  45. //OBSOLETE const GET_DISPLAYNAME = 0x00010000;
  46. public const COUNT_USERS = 0x00100000;
  47. public const GROUP_DETAILS = 0x01000000;
  48. /**
  49. * @since 13.0.0
  50. */
  51. public const IS_ADMIN = 0x10000000;
  52. /**
  53. * Check if backend implements actions
  54. * @param int $actions bitwise-or'ed actions
  55. * @return boolean
  56. * @since 4.5.0
  57. *
  58. * Returns the supported actions as int to be
  59. * compared with \OC_Group_Backend::CREATE_GROUP etc.
  60. */
  61. public function implementsActions($actions);
  62. /**
  63. * is user in group?
  64. * @param string $uid uid of the user
  65. * @param string $gid gid of the group
  66. * @return bool
  67. * @since 4.5.0
  68. *
  69. * Checks whether the user is member of a group or not.
  70. */
  71. public function inGroup($uid, $gid);
  72. /**
  73. * Get all groups a user belongs to
  74. * @param string $uid Name of the user
  75. * @return array an array of group names
  76. * @since 4.5.0
  77. *
  78. * This function fetches all groups a user belongs to. It does not check
  79. * if the user exists at all.
  80. */
  81. public function getUserGroups($uid);
  82. /**
  83. * @brief Get a list of all groups
  84. *
  85. * @param string $search
  86. * @param int $limit
  87. * @param int $offset
  88. * @return array an array of group names
  89. * @since 4.5.0
  90. *
  91. * Returns a list with all groups
  92. */
  93. public function getGroups(string $search = '', int $limit = -1, int $offset = 0);
  94. /**
  95. * @brief Check if a group exists
  96. *
  97. * @param string $gid
  98. * @return bool
  99. * @since 4.5.0
  100. */
  101. public function groupExists($gid);
  102. /**
  103. * @brief Get a list of user ids in a group matching the given search parameters.
  104. *
  105. * @param string $gid
  106. * @param string $search
  107. * @param int $limit
  108. * @param int $offset
  109. * @return array<int,string> an array of user ids
  110. * @since 4.5.0
  111. * @deprecated 27.0.0 Use searchInGroup instead, for performance reasons
  112. */
  113. public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
  114. }