1
0

IAccountManager.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Julius Härtl <jus@bitgrid.net>
  9. * @author Thomas Citharel <nextcloud@tcit.fr>
  10. * @author Vincent Petry <vincent@nextcloud.com>
  11. * @author Kate Döen <kate.doeen@nextcloud.com>
  12. *
  13. * @license GNU AGPL version 3 or any later version
  14. *
  15. * This program is free software: you can redistribute it and/or modify
  16. * it under the terms of the GNU Affero General Public License as
  17. * published by the Free Software Foundation, either version 3 of the
  18. * License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU Affero General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU Affero General Public License
  26. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  27. *
  28. */
  29. namespace OCP\Accounts;
  30. use OCP\IUser;
  31. /**
  32. * Access user profile information
  33. *
  34. * @since 15.0.0
  35. *
  36. */
  37. interface IAccountManager {
  38. /**
  39. * Contact details visible locally only
  40. *
  41. * @since 21.0.1
  42. */
  43. public const SCOPE_PRIVATE = 'v2-private';
  44. /**
  45. * Contact details visible locally and through public link access on local instance
  46. *
  47. * @since 21.0.1
  48. */
  49. public const SCOPE_LOCAL = 'v2-local';
  50. /**
  51. * Contact details visible locally, through public link access and on trusted federated servers.
  52. *
  53. * @since 21.0.1
  54. */
  55. public const SCOPE_FEDERATED = 'v2-federated';
  56. /**
  57. * Contact details visible locally, through public link access, on trusted federated servers
  58. * and published to the public lookup server.
  59. *
  60. * @since 21.0.1
  61. */
  62. public const SCOPE_PUBLISHED = 'v2-published';
  63. /**
  64. * Contact details only visible locally
  65. *
  66. * @since 15.0.0
  67. * @deprecated 21.0.1
  68. */
  69. public const VISIBILITY_PRIVATE = 'private';
  70. /**
  71. * Contact details visible on trusted federated servers.
  72. *
  73. * @since 15.0.0
  74. * @deprecated 21.0.1
  75. */
  76. public const VISIBILITY_CONTACTS_ONLY = 'contacts';
  77. /**
  78. * Contact details visible on trusted federated servers and in the public lookup server.
  79. *
  80. * @since 15.0.0
  81. * @deprecated 21.0.1
  82. */
  83. public const VISIBILITY_PUBLIC = 'public';
  84. /**
  85. * The list of allowed scopes
  86. *
  87. * @since 25.0.0
  88. */
  89. public const ALLOWED_SCOPES = [
  90. self::SCOPE_PRIVATE,
  91. self::SCOPE_LOCAL,
  92. self::SCOPE_FEDERATED,
  93. self::SCOPE_PUBLISHED,
  94. self::VISIBILITY_PRIVATE,
  95. self::VISIBILITY_CONTACTS_ONLY,
  96. self::VISIBILITY_PUBLIC,
  97. ];
  98. /**
  99. * @since 15.0.0
  100. */
  101. public const PROPERTY_AVATAR = 'avatar';
  102. /**
  103. * @since 15.0.0
  104. */
  105. public const PROPERTY_DISPLAYNAME = 'displayname';
  106. /**
  107. * @since 27.0.0
  108. */
  109. public const PROPERTY_DISPLAYNAME_LEGACY = 'display-name';
  110. /**
  111. * @since 15.0.0
  112. */
  113. public const PROPERTY_PHONE = 'phone';
  114. /**
  115. * @since 15.0.0
  116. */
  117. public const PROPERTY_EMAIL = 'email';
  118. /**
  119. * @since 15.0.0
  120. */
  121. public const PROPERTY_WEBSITE = 'website';
  122. /**
  123. * @since 15.0.0
  124. */
  125. public const PROPERTY_ADDRESS = 'address';
  126. /**
  127. * @since 15.0.0
  128. */
  129. public const PROPERTY_TWITTER = 'twitter';
  130. /**
  131. * @since 26.0.0
  132. */
  133. public const PROPERTY_FEDIVERSE = 'fediverse';
  134. /**
  135. * @since 23.0.0
  136. */
  137. public const PROPERTY_ORGANISATION = 'organisation';
  138. /**
  139. * @since 23.0.0
  140. */
  141. public const PROPERTY_ROLE = 'role';
  142. /**
  143. * @since 23.0.0
  144. */
  145. public const PROPERTY_HEADLINE = 'headline';
  146. /**
  147. * @since 23.0.0
  148. */
  149. public const PROPERTY_BIOGRAPHY = 'biography';
  150. /**
  151. * @since 23.0.0
  152. */
  153. public const PROPERTY_PROFILE_ENABLED = 'profile_enabled';
  154. /**
  155. * The list of allowed properties
  156. *
  157. * @since 25.0.0
  158. */
  159. public const ALLOWED_PROPERTIES = [
  160. self::PROPERTY_AVATAR,
  161. self::PROPERTY_DISPLAYNAME,
  162. self::PROPERTY_PHONE,
  163. self::PROPERTY_EMAIL,
  164. self::PROPERTY_WEBSITE,
  165. self::PROPERTY_ADDRESS,
  166. self::PROPERTY_TWITTER,
  167. self::PROPERTY_FEDIVERSE,
  168. self::PROPERTY_ORGANISATION,
  169. self::PROPERTY_ROLE,
  170. self::PROPERTY_HEADLINE,
  171. self::PROPERTY_BIOGRAPHY,
  172. self::PROPERTY_PROFILE_ENABLED,
  173. ];
  174. /**
  175. * @since 22.0.0
  176. */
  177. public const COLLECTION_EMAIL = 'additional_mail';
  178. /**
  179. * @since 15.0.0
  180. */
  181. public const NOT_VERIFIED = '0';
  182. /**
  183. * @since 15.0.0
  184. */
  185. public const VERIFICATION_IN_PROGRESS = '1';
  186. /**
  187. * @since 15.0.0
  188. */
  189. public const VERIFIED = '2';
  190. /**
  191. * Get the account data for a given user
  192. *
  193. * @since 15.0.0
  194. *
  195. * @param IUser $user
  196. * @return IAccount
  197. */
  198. public function getAccount(IUser $user): IAccount;
  199. /**
  200. * Update the account data with for the user
  201. *
  202. * @since 21.0.1
  203. *
  204. * @param IAccount $account
  205. * @throws \InvalidArgumentException Message is the property that was invalid
  206. */
  207. public function updateAccount(IAccount $account): void;
  208. /**
  209. * Search for users based on account data
  210. *
  211. * @param string $property - property or property collection name – since
  212. * NC 22 the implementation MAY add a fitting property collection into the
  213. * search even if a property name was given e.g. email property and email
  214. * collection)
  215. * @param string[] $values
  216. * @return array
  217. *
  218. * @since 21.0.0
  219. */
  220. public function searchUsers(string $property, array $values): array;
  221. }