IUser.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP;
  27. use OCP\UserInterface;
  28. /**
  29. * Interface IUser
  30. *
  31. * @package OCP
  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. }