iusermanager.php 3.2 KB

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