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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. /**
  25. * Public interface of ownCloud for apps to use.
  26. * Group Class.
  27. *
  28. */
  29. // use OCP namespace for all classes that are considered public.
  30. // This means that they should be used by apps instead of the internal ownCloud classes
  31. namespace OCP;
  32. /**
  33. * TODO actually this is a IGroupBackend
  34. *
  35. * @package OCP
  36. * @since 4.5.0
  37. */
  38. interface GroupInterface {
  39. /**
  40. * actions that user backends can define
  41. */
  42. const CREATE_GROUP = 0x00000001;
  43. const DELETE_GROUP = 0x00000010;
  44. const ADD_TO_GROUP = 0x00000100;
  45. const REMOVE_FROM_GOUP = 0x00001000; // oops
  46. const REMOVE_FROM_GROUP = 0x00001000;
  47. //OBSOLETE const GET_DISPLAYNAME = 0x00010000;
  48. const COUNT_USERS = 0x00100000;
  49. const GROUP_DETAILS = 0x01000000;
  50. /**
  51. * @since 13.0.0
  52. */
  53. const IS_ADMIN = 0x10000000;
  54. /**
  55. * Check if backend implements actions
  56. * @param int $actions bitwise-or'ed actions
  57. * @return boolean
  58. * @since 4.5.0
  59. *
  60. * Returns the supported actions as int to be
  61. * compared with \OC_Group_Backend::CREATE_GROUP etc.
  62. */
  63. public function implementsActions($actions);
  64. /**
  65. * is user in group?
  66. * @param string $uid uid of the user
  67. * @param string $gid gid of the group
  68. * @return bool
  69. * @since 4.5.0
  70. *
  71. * Checks whether the user is member of a group or not.
  72. */
  73. public function inGroup($uid, $gid);
  74. /**
  75. * Get all groups a user belongs to
  76. * @param string $uid Name of the user
  77. * @return array an array of group names
  78. * @since 4.5.0
  79. *
  80. * This function fetches all groups a user belongs to. It does not check
  81. * if the user exists at all.
  82. */
  83. public function getUserGroups($uid);
  84. /**
  85. * get a list of all groups
  86. * @param string $search
  87. * @param int $limit
  88. * @param int $offset
  89. * @return array an array of group names
  90. * @since 4.5.0
  91. *
  92. * Returns a list with all groups
  93. */
  94. public function getGroups($search = '', $limit = -1, $offset = 0);
  95. /**
  96. * check if a group exists
  97. * @param string $gid
  98. * @return bool
  99. * @since 4.5.0
  100. */
  101. public function groupExists($gid);
  102. /**
  103. * get a list of all users in a group
  104. * @param string $gid
  105. * @param string $search
  106. * @param int $limit
  107. * @param int $offset
  108. * @return array an array of user ids
  109. * @since 4.5.0
  110. */
  111. public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
  112. }