autocomplete.feature 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. # SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. Feature: autocomplete
  4. Background:
  5. Given using api version "2"
  6. And group "commongroup" exists
  7. And user "admin" belongs to group "commongroup"
  8. And user "auto" exists
  9. And user "autocomplete" exists
  10. And user "autocomplete2" exists
  11. And user "autocomplete2" belongs to group "commongroup"
  12. Scenario: getting autocomplete
  13. Given As an "admin"
  14. When get autocomplete for "auto"
  15. | id | source |
  16. | auto | users |
  17. | autocomplete | users |
  18. | autocomplete2 | users |
  19. And user "autocomplete" has status "dnd"
  20. When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "no"
  21. Then get autocomplete for "auto"
  22. | id | source | status |
  23. | auto | users | "" |
  24. | autocomplete | users | {"status":"dnd","message":null,"icon":null,"clearAt":null} |
  25. | autocomplete2 | users | "" |
  26. Scenario: getting autocomplete without enumeration
  27. Given As an "admin"
  28. When parameter "shareapi_allow_share_dialog_user_enumeration" of app "core" is set to "no"
  29. Then get autocomplete for "auto"
  30. | id | source |
  31. | auto | users |
  32. Then get autocomplete for "autocomplete"
  33. | id | source |
  34. | autocomplete | users |
  35. When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "no"
  36. Then get autocomplete for "auto"
  37. | id | source |
  38. Then get autocomplete for "autocomplete"
  39. | id | source |
  40. Scenario: getting autocomplete emails from address book with enumeration
  41. Given As an "admin"
  42. And sending "PUT" to "/cloud/users/autocomplete" with
  43. | key | email |
  44. | value | autocomplete@example.com |
  45. And there is a contact in an addressbook
  46. Then get email autocomplete for "example"
  47. | id | source |
  48. | autocomplete | users |
  49. | user@example.com | emails |
  50. Then get email autocomplete for "auto"
  51. | id | source |
  52. | autocomplete | users |
  53. Then get email autocomplete for "example"
  54. | id | source |
  55. | autocomplete | users |
  56. | user@example.com | emails |
  57. Then get email autocomplete for "autocomplete@example.com"
  58. | id | source |
  59. | autocomplete | users |
  60. Scenario: getting autocomplete emails from address book without enumeration
  61. Given As an "admin"
  62. And sending "PUT" to "/cloud/users/autocomplete" with
  63. | key | email |
  64. | value | autocomplete@example.com |
  65. And there is a contact in an addressbook
  66. And parameter "shareapi_allow_share_dialog_user_enumeration" of app "core" is set to "no"
  67. When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "no"
  68. Then get email autocomplete for "example"
  69. | id | source |
  70. | user@example.com | emails |
  71. When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "yes"
  72. Then get email autocomplete for "auto"
  73. | id | source |
  74. Then get email autocomplete for "example"
  75. | id | source |
  76. | user@example.com | emails |
  77. Then get email autocomplete for "autocomplete@example.com"
  78. | id | source |
  79. | autocomplete | users |
  80. Scenario: getting autocomplete with limited enumeration by group
  81. Given As an "admin"
  82. When parameter "shareapi_restrict_user_enumeration_to_group" of app "core" is set to "yes"
  83. Then get autocomplete for "auto"
  84. | id | source |
  85. | auto | users |
  86. | autocomplete2 | users |
  87. Then get autocomplete for "autocomplete"
  88. | id | source |
  89. | autocomplete | users |
  90. | autocomplete2 | users |
  91. Then get autocomplete for "autocomplete2"
  92. | id | source |
  93. | autocomplete2 | users |
  94. When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "no"
  95. Then get autocomplete for "autocomplete"
  96. | id | source |
  97. | autocomplete2 | users |
  98. Then get autocomplete for "autocomplete2"
  99. | id | source |
  100. | autocomplete2 | users |
  101. Scenario: getting autocomplete with limited enumeration by phone
  102. Given As an "admin"
  103. When parameter "shareapi_restrict_user_enumeration_to_phone" of app "core" is set to "yes"
  104. Then get autocomplete for "auto"
  105. | id | source |
  106. | auto | users |
  107. # autocomplete stores their phone number
  108. Given As an "autocomplete"
  109. And sending "PUT" to "/cloud/users/autocomplete" with
  110. | key | phone |
  111. | value | +49 711 / 25 24 28-90 |
  112. And the HTTP status code should be "200"
  113. And the OCS status code should be "200"
  114. Given As an "admin"
  115. Then get autocomplete for "auto"
  116. | id | source |
  117. | auto | users |
  118. # admin populates they have the phone number
  119. When search users by phone for region "DE" with
  120. | random-string1 | 0711 / 252 428-90 |
  121. Then get autocomplete for "auto"
  122. | id | source |
  123. | auto | users |
  124. | autocomplete | users |
  125. When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "no"
  126. Then get autocomplete for "auto"
  127. | id | source |
  128. | autocomplete | users |
  129. Scenario: getting autocomplete with limited enumeration by group or phone
  130. Given As an "admin"
  131. When parameter "shareapi_restrict_user_enumeration_to_group" of app "core" is set to "yes"
  132. And parameter "shareapi_restrict_user_enumeration_to_phone" of app "core" is set to "yes"
  133. # autocomplete stores their phone number
  134. Given As an "autocomplete"
  135. And sending "PUT" to "/cloud/users/autocomplete" with
  136. | key | phone |
  137. | value | +49 711 / 25 24 28-90 |
  138. And the HTTP status code should be "200"
  139. And the OCS status code should be "200"
  140. # admin populates they have the phone number
  141. Given As an "admin"
  142. When search users by phone for region "DE" with
  143. | random-string1 | 0711 / 252 428-90 |
  144. Then get autocomplete for "auto"
  145. | id | source |
  146. | auto | users |
  147. | autocomplete | users |
  148. | autocomplete2 | users |
  149. When parameter "shareapi_restrict_user_enumeration_full_match" of app "core" is set to "no"
  150. Then get autocomplete for "auto"
  151. | id | source |
  152. | autocomplete | users |
  153. | autocomplete2 | users |
  154. Scenario: getting autocomplete with limited enumeration but sharing is group restricted
  155. Given As an "admin"
  156. When parameter "shareapi_restrict_user_enumeration_to_group" of app "core" is set to "yes"
  157. And parameter "shareapi_restrict_user_enumeration_to_phone" of app "core" is set to "yes"
  158. # autocomplete stores their phone number
  159. Given As an "autocomplete"
  160. And sending "PUT" to "/cloud/users/autocomplete" with
  161. | key | phone |
  162. | value | +49 711 / 25 24 28-90 |
  163. And the HTTP status code should be "200"
  164. And the OCS status code should be "200"
  165. # admin populates they have the phone number
  166. Given As an "admin"
  167. When search users by phone for region "DE" with
  168. | random-string1 | 0711 / 252 428-90 |
  169. Then get autocomplete for "auto"
  170. | id | source |
  171. | auto | users |
  172. | autocomplete | users |
  173. | autocomplete2 | users |
  174. When parameter "shareapi_only_share_with_group_members" of app "core" is set to "yes"
  175. Then get autocomplete for "auto"
  176. | id | source |
  177. | autocomplete2 | users |
  178. Scenario: getting autocomplete with limited enumeration by phone but user changes it
  179. Given As an "admin"
  180. When parameter "shareapi_restrict_user_enumeration_to_phone" of app "core" is set to "yes"
  181. Then get autocomplete for "auto"
  182. | id | source |
  183. | auto | users |
  184. # autocomplete stores their phone number
  185. Given As an "autocomplete"
  186. And sending "PUT" to "/cloud/users/autocomplete" with
  187. | key | phone |
  188. | value | +49 711 / 25 24 28-90 |
  189. And the HTTP status code should be "200"
  190. And the OCS status code should be "200"
  191. Given As an "admin"
  192. Then get autocomplete for "auto"
  193. | id | source |
  194. | auto | users |
  195. # admin populates they have the phone number
  196. When search users by phone for region "DE" with
  197. | random-string1 | 0711 / 252 428-90 |
  198. Then get autocomplete for "auto"
  199. | id | source |
  200. | auto | users |
  201. | autocomplete | users |
  202. # autocomplete changes their phone number
  203. Given As an "autocomplete"
  204. And sending "PUT" to "/cloud/users/autocomplete" with
  205. | key | phone |
  206. | value | +49 711 / 25 24 28-91 |
  207. And the HTTP status code should be "200"
  208. And the OCS status code should be "200"
  209. Given As an "admin"
  210. Then get autocomplete for "auto"
  211. | id | source |
  212. | auto | users |
  213. # admin populates they have the new phone number
  214. When search users by phone for region "DE" with
  215. | random-string1 | 0711 / 252 428-91 |
  216. Then get autocomplete for "auto"
  217. | id | source |
  218. | auto | users |
  219. | autocomplete | users |
  220. Scenario: getting autocomplete without enumeration and sharing is group restricted
  221. Given As an "admin"
  222. When parameter "shareapi_allow_share_dialog_user_enumeration" of app "core" is set to "no"
  223. And parameter "shareapi_only_share_with_group_members" of app "core" is set to "yes"
  224. Then get autocomplete for "auto"
  225. | id | source |
  226. Then get autocomplete for "autocomplete"
  227. | id | source |
  228. Then get autocomplete for "autocomplete2"
  229. | id | source |
  230. | autocomplete2 | users |