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

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