1
0

iusermanager.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. */
  37. interface IUserManager {
  38. /**
  39. * register a user backend
  40. *
  41. * @param \OCP\UserInterface $backend
  42. */
  43. public function registerBackend($backend);
  44. /**
  45. * Get the active backends
  46. * @return \OCP\UserInterface[]
  47. */
  48. public function getBackends();
  49. /**
  50. * remove a user backend
  51. *
  52. * @param \OCP\UserInterface $backend
  53. */
  54. public function removeBackend($backend);
  55. /**
  56. * remove all user backends
  57. */
  58. public function clearBackends() ;
  59. /**
  60. * get a user by user id
  61. *
  62. * @param string $uid
  63. * @return \OCP\IUser|null Either the user or null if the specified user does not exist
  64. */
  65. public function get($uid);
  66. /**
  67. * check if a user exists
  68. *
  69. * @param string $uid
  70. * @return bool
  71. */
  72. public function userExists($uid);
  73. /**
  74. * Check if the password is valid for the user
  75. *
  76. * @param string $loginname
  77. * @param string $password
  78. * @return mixed the User object on success, false otherwise
  79. */
  80. public function checkPassword($loginname, $password);
  81. /**
  82. * search by user id
  83. *
  84. * @param string $pattern
  85. * @param int $limit
  86. * @param int $offset
  87. * @return \OCP\IUser[]
  88. */
  89. public function search($pattern, $limit = null, $offset = null);
  90. /**
  91. * search by displayName
  92. *
  93. * @param string $pattern
  94. * @param int $limit
  95. * @param int $offset
  96. * @return \OCP\IUser[]
  97. */
  98. public function searchDisplayName($pattern, $limit = null, $offset = null);
  99. /**
  100. * @param string $uid
  101. * @param string $password
  102. * @throws \Exception
  103. * @return bool|\OCP\IUser the created user of false
  104. */
  105. public function createUser($uid, $password);
  106. /**
  107. * returns how many users per backend exist (if supported by backend)
  108. *
  109. * @return array an array of backend class as key and count number as value
  110. */
  111. public function countUsers();
  112. }