IAccountManager.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Accounts;
  8. use OCP\IUser;
  9. /**
  10. * Access user profile information
  11. *
  12. * @since 15.0.0
  13. *
  14. */
  15. interface IAccountManager {
  16. /**
  17. * Contact details visible locally only
  18. *
  19. * @since 21.0.1
  20. */
  21. public const SCOPE_PRIVATE = 'v2-private';
  22. /**
  23. * Contact details visible locally and through public link access on local instance
  24. *
  25. * @since 21.0.1
  26. */
  27. public const SCOPE_LOCAL = 'v2-local';
  28. /**
  29. * Contact details visible locally, through public link access and on trusted federated servers.
  30. *
  31. * @since 21.0.1
  32. */
  33. public const SCOPE_FEDERATED = 'v2-federated';
  34. /**
  35. * Contact details visible locally, through public link access, on trusted federated servers
  36. * and published to the public lookup server.
  37. *
  38. * @since 21.0.1
  39. */
  40. public const SCOPE_PUBLISHED = 'v2-published';
  41. /**
  42. * Contact details only visible locally
  43. *
  44. * @since 15.0.0
  45. * @deprecated 21.0.1
  46. */
  47. public const VISIBILITY_PRIVATE = 'private';
  48. /**
  49. * Contact details visible on trusted federated servers.
  50. *
  51. * @since 15.0.0
  52. * @deprecated 21.0.1
  53. */
  54. public const VISIBILITY_CONTACTS_ONLY = 'contacts';
  55. /**
  56. * Contact details visible on trusted federated servers and in the public lookup server.
  57. *
  58. * @since 15.0.0
  59. * @deprecated 21.0.1
  60. */
  61. public const VISIBILITY_PUBLIC = 'public';
  62. /**
  63. * The list of allowed scopes
  64. *
  65. * @since 25.0.0
  66. */
  67. public const ALLOWED_SCOPES = [
  68. self::SCOPE_PRIVATE,
  69. self::SCOPE_LOCAL,
  70. self::SCOPE_FEDERATED,
  71. self::SCOPE_PUBLISHED,
  72. self::VISIBILITY_PRIVATE,
  73. self::VISIBILITY_CONTACTS_ONLY,
  74. self::VISIBILITY_PUBLIC,
  75. ];
  76. /**
  77. * @since 15.0.0
  78. */
  79. public const PROPERTY_AVATAR = 'avatar';
  80. /**
  81. * @since 15.0.0
  82. */
  83. public const PROPERTY_DISPLAYNAME = 'displayname';
  84. /**
  85. * @since 27.0.0
  86. */
  87. public const PROPERTY_DISPLAYNAME_LEGACY = 'display-name';
  88. /**
  89. * @since 15.0.0
  90. */
  91. public const PROPERTY_PHONE = 'phone';
  92. /**
  93. * @since 15.0.0
  94. */
  95. public const PROPERTY_EMAIL = 'email';
  96. /**
  97. * @since 15.0.0
  98. */
  99. public const PROPERTY_WEBSITE = 'website';
  100. /**
  101. * @since 15.0.0
  102. */
  103. public const PROPERTY_ADDRESS = 'address';
  104. /**
  105. * @since 15.0.0
  106. */
  107. public const PROPERTY_TWITTER = 'twitter';
  108. /**
  109. * @since 26.0.0
  110. */
  111. public const PROPERTY_FEDIVERSE = 'fediverse';
  112. /**
  113. * @since 23.0.0
  114. */
  115. public const PROPERTY_ORGANISATION = 'organisation';
  116. /**
  117. * @since 23.0.0
  118. */
  119. public const PROPERTY_ROLE = 'role';
  120. /**
  121. * @since 23.0.0
  122. */
  123. public const PROPERTY_HEADLINE = 'headline';
  124. /**
  125. * @since 23.0.0
  126. */
  127. public const PROPERTY_BIOGRAPHY = 'biography';
  128. /**
  129. * @since 23.0.0
  130. */
  131. public const PROPERTY_PROFILE_ENABLED = 'profile_enabled';
  132. /**
  133. * @since 30.0.0
  134. */
  135. public const PROPERTY_BIRTHDATE = 'birthdate';
  136. /**
  137. * The list of allowed properties
  138. *
  139. * @since 25.0.0
  140. */
  141. public const ALLOWED_PROPERTIES = [
  142. self::PROPERTY_AVATAR,
  143. self::PROPERTY_DISPLAYNAME,
  144. self::PROPERTY_PHONE,
  145. self::PROPERTY_EMAIL,
  146. self::PROPERTY_WEBSITE,
  147. self::PROPERTY_ADDRESS,
  148. self::PROPERTY_TWITTER,
  149. self::PROPERTY_FEDIVERSE,
  150. self::PROPERTY_ORGANISATION,
  151. self::PROPERTY_ROLE,
  152. self::PROPERTY_HEADLINE,
  153. self::PROPERTY_BIOGRAPHY,
  154. self::PROPERTY_PROFILE_ENABLED,
  155. self::PROPERTY_BIRTHDATE,
  156. ];
  157. /**
  158. * @since 22.0.0
  159. */
  160. public const COLLECTION_EMAIL = 'additional_mail';
  161. /**
  162. * @since 15.0.0
  163. */
  164. public const NOT_VERIFIED = '0';
  165. /**
  166. * @since 15.0.0
  167. */
  168. public const VERIFICATION_IN_PROGRESS = '1';
  169. /**
  170. * @since 15.0.0
  171. */
  172. public const VERIFIED = '2';
  173. /**
  174. * Get the account data for a given user
  175. *
  176. * @since 15.0.0
  177. *
  178. * @param IUser $user
  179. * @return IAccount
  180. */
  181. public function getAccount(IUser $user): IAccount;
  182. /**
  183. * Update the account data with for the user
  184. *
  185. * @since 21.0.1
  186. *
  187. * @param IAccount $account
  188. * @throws \InvalidArgumentException Message is the property that was invalid
  189. */
  190. public function updateAccount(IAccount $account): void;
  191. /**
  192. * Search for users based on account data
  193. *
  194. * @param string $property - property or property collection name – since
  195. * NC 22 the implementation MAY add a fitting property collection into the
  196. * search even if a property name was given e.g. email property and email
  197. * collection)
  198. * @param string[] $values
  199. * @return array
  200. *
  201. * @since 21.0.0
  202. */
  203. public function searchUsers(string $property, array $values): array;
  204. }