1
0

IAccountManager.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. * @since 31.0.0
  138. */
  139. public const PROPERTY_PRONOUNS = 'pronouns';
  140. /**
  141. * The list of allowed properties
  142. *
  143. * @since 25.0.0
  144. */
  145. public const ALLOWED_PROPERTIES = [
  146. self::PROPERTY_ADDRESS,
  147. self::PROPERTY_AVATAR,
  148. self::PROPERTY_BIOGRAPHY,
  149. self::PROPERTY_BIRTHDATE,
  150. self::PROPERTY_DISPLAYNAME,
  151. self::PROPERTY_EMAIL,
  152. self::PROPERTY_FEDIVERSE,
  153. self::PROPERTY_HEADLINE,
  154. self::PROPERTY_ORGANISATION,
  155. self::PROPERTY_PHONE,
  156. self::PROPERTY_PROFILE_ENABLED,
  157. self::PROPERTY_PRONOUNS,
  158. self::PROPERTY_ROLE,
  159. self::PROPERTY_TWITTER,
  160. self::PROPERTY_WEBSITE,
  161. ];
  162. /**
  163. * @since 22.0.0
  164. */
  165. public const COLLECTION_EMAIL = 'additional_mail';
  166. /**
  167. * @since 15.0.0
  168. */
  169. public const NOT_VERIFIED = '0';
  170. /**
  171. * @since 15.0.0
  172. */
  173. public const VERIFICATION_IN_PROGRESS = '1';
  174. /**
  175. * @since 15.0.0
  176. */
  177. public const VERIFIED = '2';
  178. /**
  179. * Get the account data for a given user
  180. *
  181. * @since 15.0.0
  182. *
  183. * @param IUser $user
  184. * @return IAccount
  185. */
  186. public function getAccount(IUser $user): IAccount;
  187. /**
  188. * Update the account data with for the user
  189. *
  190. * @since 21.0.1
  191. *
  192. * @param IAccount $account
  193. * @throws \InvalidArgumentException Message is the property that was invalid
  194. */
  195. public function updateAccount(IAccount $account): void;
  196. /**
  197. * Search for users based on account data
  198. *
  199. * @param string $property - property or property collection name – since
  200. * NC 22 the implementation MAY add a fitting property collection into the
  201. * search even if a property name was given e.g. email property and email
  202. * collection)
  203. * @param string[] $values
  204. * @return array
  205. *
  206. * @since 21.0.0
  207. */
  208. public function searchUsers(string $property, array $values): array;
  209. }