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.

IAccountManager.php 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. *
  12. * @license GNU AGPL version 3 or any later version
  13. *
  14. * This program is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License as
  16. * published by the Free Software Foundation, either version 3 of the
  17. * License, or (at your option) any later version.
  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
  25. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. *
  27. */
  28. namespace OCP\Accounts;
  29. use OCP\IUser;
  30. /**
  31. * Access user profile information
  32. *
  33. * @since 15.0.0
  34. *
  35. */
  36. interface IAccountManager {
  37. /**
  38. * Contact details visible locally only
  39. *
  40. * @since 21.0.1
  41. */
  42. public const SCOPE_PRIVATE = 'v2-private';
  43. /**
  44. * Contact details visible locally and through public link access on local instance
  45. *
  46. * @since 21.0.1
  47. */
  48. public const SCOPE_LOCAL = 'v2-local';
  49. /**
  50. * Contact details visible locally, through public link access and on trusted federated servers.
  51. *
  52. * @since 21.0.1
  53. */
  54. public const SCOPE_FEDERATED = 'v2-federated';
  55. /**
  56. * Contact details visible locally, through public link access, on trusted federated servers
  57. * and published to the public lookup server.
  58. *
  59. * @since 21.0.1
  60. */
  61. public const SCOPE_PUBLISHED = 'v2-published';
  62. /**
  63. * Contact details only visible locally
  64. *
  65. * @deprecated 21.0.1
  66. */
  67. public const VISIBILITY_PRIVATE = 'private';
  68. /**
  69. * Contact details visible on trusted federated servers.
  70. *
  71. * @deprecated 21.0.1
  72. */
  73. public const VISIBILITY_CONTACTS_ONLY = 'contacts';
  74. /**
  75. * Contact details visible on trusted federated servers and in the public lookup server.
  76. *
  77. * @deprecated 21.0.1
  78. */
  79. public const VISIBILITY_PUBLIC = 'public';
  80. /**
  81. * The list of allowed scopes
  82. *
  83. * @since 25.0.0
  84. */
  85. public const ALLOWED_SCOPES = [
  86. self::SCOPE_PRIVATE,
  87. self::SCOPE_LOCAL,
  88. self::SCOPE_FEDERATED,
  89. self::SCOPE_PUBLISHED,
  90. self::VISIBILITY_PRIVATE,
  91. self::VISIBILITY_CONTACTS_ONLY,
  92. self::VISIBILITY_PUBLIC,
  93. ];
  94. public const PROPERTY_AVATAR = 'avatar';
  95. public const PROPERTY_DISPLAYNAME = 'displayname';
  96. public const PROPERTY_PHONE = 'phone';
  97. public const PROPERTY_EMAIL = 'email';
  98. public const PROPERTY_WEBSITE = 'website';
  99. public const PROPERTY_ADDRESS = 'address';
  100. public const PROPERTY_TWITTER = 'twitter';
  101. /**
  102. * @since 23.0.0
  103. */
  104. public const PROPERTY_ORGANISATION = 'organisation';
  105. /**
  106. * @since 23.0.0
  107. */
  108. public const PROPERTY_ROLE = 'role';
  109. /**
  110. * @since 23.0.0
  111. */
  112. public const PROPERTY_HEADLINE = 'headline';
  113. /**
  114. * @since 23.0.0
  115. */
  116. public const PROPERTY_BIOGRAPHY = 'biography';
  117. /**
  118. * @since 23.0.0
  119. */
  120. public const PROPERTY_PROFILE_ENABLED = 'profile_enabled';
  121. /**
  122. * The list of allowed properties
  123. *
  124. * @since 25.0.0
  125. */
  126. public const ALLOWED_PROPERTIES = [
  127. self::PROPERTY_AVATAR,
  128. self::PROPERTY_DISPLAYNAME,
  129. self::PROPERTY_PHONE,
  130. self::PROPERTY_EMAIL,
  131. self::PROPERTY_WEBSITE,
  132. self::PROPERTY_ADDRESS,
  133. self::PROPERTY_TWITTER,
  134. self::PROPERTY_ORGANISATION,
  135. self::PROPERTY_ROLE,
  136. self::PROPERTY_HEADLINE,
  137. self::PROPERTY_BIOGRAPHY,
  138. self::PROPERTY_PROFILE_ENABLED,
  139. ];
  140. public const COLLECTION_EMAIL = 'additional_mail';
  141. public const NOT_VERIFIED = '0';
  142. public const VERIFICATION_IN_PROGRESS = '1';
  143. public const VERIFIED = '2';
  144. /**
  145. * Get the account data for a given user
  146. *
  147. * @since 15.0.0
  148. *
  149. * @param IUser $user
  150. * @return IAccount
  151. */
  152. public function getAccount(IUser $user): IAccount;
  153. /**
  154. * Update the account data with for the user
  155. *
  156. * @since 21.0.1
  157. *
  158. * @param IAccount $account
  159. * @throws \InvalidArgumentException Message is the property that was invalid
  160. */
  161. public function updateAccount(IAccount $account): void;
  162. /**
  163. * Search for users based on account data
  164. *
  165. * @param string $property - property or property collection name – since
  166. * NC 22 the implementation MAY add a fitting property collection into the
  167. * search even if a property name was given e.g. email property and email
  168. * collection)
  169. * @param string[] $values
  170. * @return array
  171. *
  172. * @since 21.0.0
  173. */
  174. public function searchUsers(string $property, array $values): array;
  175. }