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.

IUser.php 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author John Molakvoæ <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. use InvalidArgumentException;
  30. /**
  31. * Interface IUser
  32. *
  33. * @since 8.0.0
  34. */
  35. interface IUser {
  36. /**
  37. * get the user id
  38. *
  39. * @return string
  40. * @since 8.0.0
  41. */
  42. public function getUID();
  43. /**
  44. * get the display name for the user, if no specific display name is set it will fallback to the user id
  45. *
  46. * @return string
  47. * @since 8.0.0
  48. */
  49. public function getDisplayName();
  50. /**
  51. * set the display name for the user
  52. *
  53. * @param string $displayName
  54. * @return bool
  55. * @since 8.0.0
  56. */
  57. public function setDisplayName($displayName);
  58. /**
  59. * returns the timestamp of the user's last login or 0 if the user did never
  60. * login
  61. *
  62. * @return int
  63. * @since 8.0.0
  64. */
  65. public function getLastLogin();
  66. /**
  67. * updates the timestamp of the most recent login of this user
  68. * @since 8.0.0
  69. */
  70. public function updateLastLoginTimestamp();
  71. /**
  72. * Delete the user
  73. *
  74. * @return bool
  75. * @since 8.0.0
  76. */
  77. public function delete();
  78. /**
  79. * Set the password of the user
  80. *
  81. * @param string $password
  82. * @param string $recoveryPassword for the encryption app to reset encryption keys
  83. * @return bool
  84. * @since 8.0.0
  85. */
  86. public function setPassword($password, $recoveryPassword = null);
  87. /**
  88. * get the users home folder to mount
  89. *
  90. * @return string
  91. * @since 8.0.0
  92. */
  93. public function getHome();
  94. /**
  95. * Get the name of the backend class the user is connected with
  96. *
  97. * @return string
  98. * @since 8.0.0
  99. */
  100. public function getBackendClassName();
  101. /**
  102. * Get the backend for the current user object
  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 user's email address
  144. *
  145. * @return string|null
  146. * @since 9.0.0
  147. */
  148. public function getEMailAddress();
  149. /**
  150. * get the user's system email address
  151. *
  152. * The system mail address may be read only and may be set from different
  153. * sources like LDAP, SAML or simply the admin.
  154. *
  155. * Use this getter only when the system address is needed. For picking the
  156. * proper address to e.g. send a mail to, use getEMailAddress().
  157. *
  158. * @return string|null
  159. * @since 23.0.0
  160. */
  161. public function getSystemEMailAddress(): ?string;
  162. /**
  163. * get the user's preferred email address
  164. *
  165. * The primary mail address may be set be the user to specify a different
  166. * email address where mails by Nextcloud are sent to. It is not necessarily
  167. * set.
  168. *
  169. * Use this getter only when the primary address is needed. For picking the
  170. * proper address to e.g. send a mail to, use getEMailAddress().
  171. *
  172. * @return string|null
  173. * @since 23.0.0
  174. */
  175. public function getPrimaryEMailAddress(): ?string;
  176. /**
  177. * get the avatar image if it exists
  178. *
  179. * @param int $size
  180. * @return IImage|null
  181. * @since 9.0.0
  182. */
  183. public function getAvatarImage($size);
  184. /**
  185. * get the federation cloud id
  186. *
  187. * @return string
  188. * @since 9.0.0
  189. */
  190. public function getCloudId();
  191. /**
  192. * set the email address of the user
  193. *
  194. * It is an alias to setSystemEMailAddress()
  195. *
  196. * @param string|null $mailAddress
  197. * @return void
  198. * @since 9.0.0
  199. * @deprecated 23.0.0 use setSystemEMailAddress() or setPrimaryEMailAddress()
  200. */
  201. public function setEMailAddress($mailAddress);
  202. /**
  203. * Set the system email address of the user
  204. *
  205. * This is supposed to be used when the email is set from different sources
  206. * (i.e. other user backends, admin).
  207. *
  208. * @since 23.0.0
  209. */
  210. public function setSystemEMailAddress(string $mailAddress): void;
  211. /**
  212. * Set the primary email address of the user.
  213. *
  214. * This method should be typically called when the user is changing their
  215. * own primary address and is not allowed to change their system email.
  216. *
  217. * The mail address provided here must be already registered as an
  218. * additional mail in the user account and also be verified locally. Also
  219. * an empty string is allowed to delete this preference.
  220. *
  221. * @throws InvalidArgumentException when the provided email address does not
  222. * satisfy constraints.
  223. *
  224. * @since 23.0.0
  225. */
  226. public function setPrimaryEMailAddress(string $mailAddress): void;
  227. /**
  228. * get the users' quota in human readable form. If a specific quota is not
  229. * set for the user, the default value is returned. If a default setting
  230. * was not set otherwise, it is return as 'none', i.e. quota is not limited.
  231. *
  232. * @return string
  233. * @since 9.0.0
  234. */
  235. public function getQuota();
  236. /**
  237. * set the users' quota
  238. *
  239. * @param string $quota
  240. * @return void
  241. * @since 9.0.0
  242. */
  243. public function setQuota($quota);
  244. }