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.

example.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @copyright 2012 Frank Karlitschek frank@owncloud.org
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * abstract reference class for group management
  24. * this class should only be used as a reference for method signatures and their descriptions
  25. */
  26. abstract class OC_Group_Example {
  27. /**
  28. * @brief Try to create a new group
  29. * @param $gid The name of the group to create
  30. * @returns true/false
  31. *
  32. * Trys to create a new group. If the group name already exists, false will
  33. * be returned.
  34. */
  35. abstract public static function createGroup($gid);
  36. /**
  37. * @brief delete a group
  38. * @param $gid gid of the group to delete
  39. * @returns true/false
  40. *
  41. * Deletes a group and removes it from the group_user-table
  42. */
  43. abstract public static function deleteGroup($gid);
  44. /**
  45. * @brief is user in group?
  46. * @param $uid uid of the user
  47. * @param $gid gid of the group
  48. * @returns true/false
  49. *
  50. * Checks whether the user is member of a group or not.
  51. */
  52. abstract public static function inGroup($uid, $gid);
  53. /**
  54. * @brief Add a user to a group
  55. * @param $uid Name of the user to add to group
  56. * @param $gid Name of the group in which add the user
  57. * @returns true/false
  58. *
  59. * Adds a user to a group.
  60. */
  61. abstract public static function addToGroup($uid, $gid);
  62. /**
  63. * @brief Removes a user from a group
  64. * @param $uid NameUSER of the user to remove from group
  65. * @param $gid Name of the group from which remove the user
  66. * @returns true/false
  67. *
  68. * removes the user from a group.
  69. */
  70. abstract public static function removeFromGroup($uid, $gid);
  71. /**
  72. * @brief Get all groups a user belongs to
  73. * @param $uid Name of the user
  74. * @returns array with group names
  75. *
  76. * This function fetches all groups a user belongs to. It does not check
  77. * if the user exists at all.
  78. */
  79. abstract public static function getUserGroups($uid);
  80. /**
  81. * @brief get a list of all groups
  82. * @returns array with group names
  83. *
  84. * Returns a list with all groups
  85. */
  86. abstract public static function getGroups($search = '', $limit = -1, $offset = 0);
  87. /**
  88. * check if a group exists
  89. * @param string $gid
  90. * @return bool
  91. */
  92. abstract public function groupExists($gid);
  93. /**
  94. * @brief get a list of all users in a group
  95. * @returns array with user ids
  96. */
  97. abstract public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
  98. }