example.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /**
  3. * @author Bart Visscher <bartv@thisnet.nl>
  4. * @author Felix Moeller <mail@felixmoeller.de>
  5. * @author Lukas Reschke <lukas@owncloud.com>
  6. * @author Michael Gapczynski <GapczynskiM@gmail.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <icewind@owncloud.com>
  9. * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
  10. *
  11. * @copyright Copyright (c) 2015, ownCloud, Inc.
  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. * abstract reference class for group management
  29. * this class should only be used as a reference for method signatures and their descriptions
  30. */
  31. abstract class OC_Group_Example {
  32. /**
  33. * Try to create a new group
  34. * @param string $gid The name of the group to create
  35. * @return bool
  36. *
  37. * Tries to create a new group. If the group name already exists, false will
  38. * be returned.
  39. */
  40. abstract public static function createGroup($gid);
  41. /**
  42. * delete a group
  43. * @param string $gid gid of the group to delete
  44. * @return bool
  45. *
  46. * Deletes a group and removes it from the group_user-table
  47. */
  48. abstract public static function deleteGroup($gid);
  49. /**
  50. * is user in group?
  51. * @param string $uid uid of the user
  52. * @param string $gid gid of the group
  53. * @return bool
  54. *
  55. * Checks whether the user is member of a group or not.
  56. */
  57. abstract public static function inGroup($uid, $gid);
  58. /**
  59. * Add a user to a group
  60. * @param string $uid Name of the user to add to group
  61. * @param string $gid Name of the group in which add the user
  62. * @return bool
  63. *
  64. * Adds a user to a group.
  65. */
  66. abstract public static function addToGroup($uid, $gid);
  67. /**
  68. * Removes a user from a group
  69. * @param string $uid Name of the user to remove from group
  70. * @param string $gid Name of the group from which remove the user
  71. * @return bool
  72. *
  73. * removes the user from a group.
  74. */
  75. abstract public static function removeFromGroup($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. *
  81. * This function fetches all groups a user belongs to. It does not check
  82. * if the user exists at all.
  83. */
  84. abstract public static function getUserGroups($uid);
  85. /**
  86. * get a list of all groups
  87. * @param string $search
  88. * @param int $limit
  89. * @param int $offset
  90. * @return array an array of group names
  91. */
  92. abstract public static function getGroups($search = '', $limit = -1, $offset = 0);
  93. /**
  94. * Check if a group exists
  95. * @param string $gid
  96. * @return bool
  97. */
  98. abstract public function groupExists($gid);
  99. /**
  100. * get a list of all users in a group
  101. * @param string $gid
  102. * @param string $search
  103. * @param int $limit
  104. * @param int $offset
  105. * @return array an array of user ids
  106. */
  107. abstract public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
  108. }