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.

212 lines
4.3 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Robin Appelman <robin@icewind.nl>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. * @author Thomas Müller <thomas.mueller@tmit.eu>
  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. namespace OCP;
  29. /**
  30. * Interface IUser
  31. *
  32. * @since 8.0.0
  33. */
  34. interface IUser {
  35. /**
  36. * get the user id
  37. *
  38. * @return string
  39. * @since 8.0.0
  40. */
  41. public function getUID();
  42. /**
  43. * get the display name for the user, if no specific display name is set it will fallback to the user id
  44. *
  45. * @return string
  46. * @since 8.0.0
  47. */
  48. public function getDisplayName();
  49. /**
  50. * set the display name for the user
  51. *
  52. * @param string $displayName
  53. * @return bool
  54. * @since 8.0.0
  55. */
  56. public function setDisplayName($displayName);
  57. /**
  58. * returns the timestamp of the user's last login or 0 if the user did never
  59. * login
  60. *
  61. * @return int
  62. * @since 8.0.0
  63. */
  64. public function getLastLogin();
  65. /**
  66. * updates the timestamp of the most recent login of this user
  67. * @since 8.0.0
  68. */
  69. public function updateLastLoginTimestamp();
  70. /**
  71. * Delete the user
  72. *
  73. * @return bool
  74. * @since 8.0.0
  75. */
  76. public function delete();
  77. /**
  78. * Set the password of the user
  79. *
  80. * @param string $password
  81. * @param string $recoveryPassword for the encryption app to reset encryption keys
  82. * @return bool
  83. * @since 8.0.0
  84. */
  85. public function setPassword($password, $recoveryPassword = null);
  86. /**
  87. * get the users home folder to mount
  88. *
  89. * @return string
  90. * @since 8.0.0
  91. */
  92. public function getHome();
  93. /**
  94. * Get the name of the backend class the user is connected with
  95. *
  96. * @return string
  97. * @since 8.0.0
  98. */
  99. public function getBackendClassName();
  100. /**
  101. * Get the backend for the current user object
  102. *
  103. * @return UserInterface
  104. * @since 15.0.0
  105. */
  106. public function getBackend();
  107. /**
  108. * check if the backend allows the user to change his avatar on Personal page
  109. *
  110. * @return bool
  111. * @since 8.0.0
  112. */
  113. public function canChangeAvatar();
  114. /**
  115. * check if the backend supports changing passwords
  116. *
  117. * @return bool
  118. * @since 8.0.0
  119. */
  120. public function canChangePassword();
  121. /**
  122. * check if the backend supports changing display names
  123. *
  124. * @return bool
  125. * @since 8.0.0
  126. */
  127. public function canChangeDisplayName();
  128. /**
  129. * check if the user is enabled
  130. *
  131. * @return bool
  132. * @since 8.0.0
  133. */
  134. public function isEnabled();
  135. /**
  136. * set the enabled status for the user
  137. *
  138. * @param bool $enabled
  139. * @since 8.0.0
  140. */
  141. public function setEnabled(bool $enabled = true);
  142. /**
  143. * get the users email address
  144. *
  145. * @return string|null
  146. * @since 9.0.0
  147. */
  148. public function getEMailAddress();
  149. /**
  150. * get the avatar image if it exists
  151. *
  152. * @param int $size
  153. * @return IImage|null
  154. * @since 9.0.0
  155. */
  156. public function getAvatarImage($size);
  157. /**
  158. * get the federation cloud id
  159. *
  160. * @return string
  161. * @since 9.0.0
  162. */
  163. public function getCloudId();
  164. /**
  165. * set the email address of the user
  166. *
  167. * @param string|null $mailAddress
  168. * @return void
  169. * @since 9.0.0
  170. */
  171. public function setEMailAddress($mailAddress);
  172. /**
  173. * get the users' quota in human readable form. If a specific quota is not
  174. * set for the user, the default value is returned. If a default setting
  175. * was not set otherwise, it is return as 'none', i.e. quota is not limited.
  176. *
  177. * @return string
  178. * @since 9.0.0
  179. */
  180. public function getQuota();
  181. /**
  182. * set the users' quota
  183. *
  184. * @param string $quota
  185. * @return void
  186. * @since 9.0.0
  187. */
  188. public function setQuota($quota);
  189. }