GroupInterface.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. // use OCP namespace for all classes that are considered public.
  8. // This means that they should be used by apps instead of the internal Nextcloud classes
  9. namespace OCP;
  10. /**
  11. * TODO actually this is a IGroupBackend
  12. *
  13. * @since 4.5.0
  14. */
  15. interface GroupInterface {
  16. /**
  17. * actions that user backends can define
  18. *
  19. * @since 12.0.0
  20. */
  21. public const CREATE_GROUP = 0x00000001;
  22. /**
  23. * @since 12.0.0
  24. */
  25. public const DELETE_GROUP = 0x00000010;
  26. /**
  27. * @since 12.0.0
  28. */
  29. public const ADD_TO_GROUP = 0x00000100;
  30. /**
  31. * @since 12.0.0
  32. * @deprecated 29.0.0
  33. */
  34. public const REMOVE_FROM_GOUP = 0x00001000; // oops
  35. /**
  36. * @since 12.0.0
  37. */
  38. public const REMOVE_FROM_GROUP = 0x00001000;
  39. //OBSOLETE const GET_DISPLAYNAME = 0x00010000;
  40. /**
  41. * @since 12.0.0
  42. */
  43. public const COUNT_USERS = 0x00100000;
  44. /**
  45. * @since 12.0.0
  46. */
  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 list<string> 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. }