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.

iusermanager.php 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. /**
  3. * @author Lukas Reschke <lukas@owncloud.com>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. * @author Thomas Müller <thomas.mueller@tmit.eu>
  7. *
  8. * @copyright Copyright (c) 2016, ownCloud, Inc.
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCP;
  25. /**
  26. * Class Manager
  27. *
  28. * Hooks available in scope \OC\User:
  29. * - preSetPassword(\OC\User\User $user, string $password, string $recoverPassword)
  30. * - postSetPassword(\OC\User\User $user, string $password, string $recoverPassword)
  31. * - preDelete(\OC\User\User $user)
  32. * - postDelete(\OC\User\User $user)
  33. * - preCreateUser(string $uid, string $password)
  34. * - postCreateUser(\OC\User\User $user, string $password)
  35. *
  36. * @package OC\User
  37. * @since 8.0.0
  38. */
  39. interface IUserManager {
  40. /**
  41. * register a user backend
  42. *
  43. * @param \OCP\UserInterface $backend
  44. * @since 8.0.0
  45. */
  46. public function registerBackend($backend);
  47. /**
  48. * Get the active backends
  49. * @return \OCP\UserInterface[]
  50. * @since 8.0.0
  51. */
  52. public function getBackends();
  53. /**
  54. * remove a user backend
  55. *
  56. * @param \OCP\UserInterface $backend
  57. * @since 8.0.0
  58. */
  59. public function removeBackend($backend);
  60. /**
  61. * remove all user backends
  62. * @since 8.0.0
  63. */
  64. public function clearBackends() ;
  65. /**
  66. * get a user by user id
  67. *
  68. * @param string $uid
  69. * @return \OCP\IUser|null Either the user or null if the specified user does not exist
  70. * @since 8.0.0
  71. */
  72. public function get($uid);
  73. /**
  74. * check if a user exists
  75. *
  76. * @param string $uid
  77. * @return bool
  78. * @since 8.0.0
  79. */
  80. public function userExists($uid);
  81. /**
  82. * Check if the password is valid for the user
  83. *
  84. * @param string $loginname
  85. * @param string $password
  86. * @return mixed the User object on success, false otherwise
  87. * @since 8.0.0
  88. */
  89. public function checkPassword($loginname, $password);
  90. /**
  91. * search by user id
  92. *
  93. * @param string $pattern
  94. * @param int $limit
  95. * @param int $offset
  96. * @return \OCP\IUser[]
  97. * @since 8.0.0
  98. */
  99. public function search($pattern, $limit = null, $offset = null);
  100. /**
  101. * search by displayName
  102. *
  103. * @param string $pattern
  104. * @param int $limit
  105. * @param int $offset
  106. * @return \OCP\IUser[]
  107. * @since 8.0.0
  108. */
  109. public function searchDisplayName($pattern, $limit = null, $offset = null);
  110. /**
  111. * @param string $uid
  112. * @param string $password
  113. * @throws \Exception
  114. * @return bool|\OCP\IUser the created user of false
  115. * @since 8.0.0
  116. */
  117. public function createUser($uid, $password);
  118. /**
  119. * returns how many users per backend exist (if supported by backend)
  120. *
  121. * @return array an array of backend class as key and count number as value
  122. * @since 8.0.0
  123. */
  124. public function countUsers();
  125. /**
  126. * @param \Closure $callback
  127. * @return void
  128. * @since 9.0.0
  129. */
  130. public function callForAllUsers (\Closure $callback, $search = '');
  131. }