GroupInterface.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 Roeland Jago Douma <roeland@famdouma.nl>
  10. * @author Vincent Petry <pvince81@owncloud.com>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. /**
  28. * Public interface of ownCloud for apps to use.
  29. * Group Class.
  30. *
  31. */
  32. // use OCP namespace for all classes that are considered public.
  33. // This means that they should be used by apps instead of the internal ownCloud classes
  34. namespace OCP;
  35. /**
  36. * TODO actually this is a IGroupBackend
  37. *
  38. * @package OCP
  39. * @since 4.5.0
  40. */
  41. interface GroupInterface {
  42. /**
  43. * actions that user backends can define
  44. */
  45. const CREATE_GROUP = 0x00000001;
  46. const DELETE_GROUP = 0x00000010;
  47. const ADD_TO_GROUP = 0x00000100;
  48. const REMOVE_FROM_GOUP = 0x00001000; // oops
  49. const REMOVE_FROM_GROUP = 0x00001000;
  50. //OBSOLETE const GET_DISPLAYNAME = 0x00010000;
  51. const COUNT_USERS = 0x00100000;
  52. const GROUP_DETAILS = 0x01000000;
  53. /**
  54. * @since 13.0.0
  55. */
  56. 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. }