You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GroupInterface.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. /**
  29. * Public interface of ownCloud for apps to use.
  30. * Group Class.
  31. *
  32. */
  33. // use OCP namespace for all classes that are considered public.
  34. // This means that they should be used by apps instead of the internal ownCloud classes
  35. namespace OCP;
  36. /**
  37. * TODO actually this is a IGroupBackend
  38. *
  39. * @since 4.5.0
  40. */
  41. interface GroupInterface {
  42. /**
  43. * actions that user backends can define
  44. */
  45. public const CREATE_GROUP = 0x00000001;
  46. public const DELETE_GROUP = 0x00000010;
  47. public const ADD_TO_GROUP = 0x00000100;
  48. public const REMOVE_FROM_GOUP = 0x00001000; // oops
  49. public const REMOVE_FROM_GROUP = 0x00001000;
  50. //OBSOLETE const GET_DISPLAYNAME = 0x00010000;
  51. public const COUNT_USERS = 0x00100000;
  52. public const GROUP_DETAILS = 0x01000000;
  53. /**
  54. * @since 13.0.0
  55. */
  56. public const IS_ADMIN = 0x10000000;
  57. /**
  58. * Check if backend implements actions
  59. * @param int $actions bitwise-or'ed actions
  60. * @return boolean
  61. * @since 4.5.0
  62. *
  63. * Returns the supported actions as int to be
  64. * compared with \OC_Group_Backend::CREATE_GROUP etc.
  65. */
  66. public function implementsActions($actions);
  67. /**
  68. * is user in group?
  69. * @param string $uid uid of the user
  70. * @param string $gid gid of the group
  71. * @return bool
  72. * @since 4.5.0
  73. *
  74. * Checks whether the user is member of a group or not.
  75. */
  76. public function inGroup($uid, $gid);
  77. /**
  78. * Get all groups a user belongs to
  79. * @param string $uid Name of the user
  80. * @return array an array of group names
  81. * @since 4.5.0
  82. *
  83. * This function fetches all groups a user belongs to. It does not check
  84. * if the user exists at all.
  85. */
  86. public function getUserGroups($uid);
  87. /**
  88. * get a list of all groups
  89. * @param string $search
  90. * @param int $limit
  91. * @param int $offset
  92. * @return array an array of group names
  93. * @since 4.5.0
  94. *
  95. * Returns a list with all groups
  96. */
  97. public function getGroups($search = '', $limit = -1, $offset = 0);
  98. /**
  99. * check if a group exists
  100. * @param string $gid
  101. * @return bool
  102. * @since 4.5.0
  103. */
  104. public function groupExists($gid);
  105. /**
  106. * get a list of all users in a group
  107. * @param string $gid
  108. * @param string $search
  109. * @param int $limit
  110. * @param int $offset
  111. * @return array an array of user ids
  112. * @since 4.5.0
  113. */
  114. public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
  115. }