example.php 3.4 KB

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