federated.feature 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. # SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-FileCopyrightText: 2015-2016 ownCloud, Inc.
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. Feature: federated
  5. Background:
  6. Given using api version "1"
  7. Scenario: Federate share a file with another server
  8. Given Using server "REMOTE"
  9. And user "user1" exists
  10. And Using server "LOCAL"
  11. And user "user0" exists
  12. When User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
  13. Then the OCS status code should be "100"
  14. And the HTTP status code should be "200"
  15. And Share fields of last share match with
  16. | id | A_NUMBER |
  17. | item_type | file |
  18. | item_source | A_NUMBER |
  19. | share_type | 6 |
  20. | file_source | A_NUMBER |
  21. | path | /textfile0.txt |
  22. | permissions | 19 |
  23. | stime | A_NUMBER |
  24. | storage | A_NUMBER |
  25. | mail_send | 0 |
  26. | uid_owner | user0 |
  27. | storage_id | home::user0 |
  28. | file_parent | A_NUMBER |
  29. | displayname_owner | user0 |
  30. | share_with | user1@REMOTE |
  31. | share_with_displayname | user1 |
  32. Scenario: Federated group share a file with another server
  33. Given Using server "REMOTE"
  34. And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
  35. And user "gs-user1" exists
  36. And user "gs-user2" exists
  37. And group "group1" exists
  38. And As an "admin"
  39. And Add user "gs-user1" to the group "group1"
  40. And Add user "gs-user2" to the group "group1"
  41. And Using server "LOCAL"
  42. And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
  43. And user "gs-user0" exists
  44. When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
  45. Then the OCS status code should be "100"
  46. And the HTTP status code should be "200"
  47. And Share fields of last share match with
  48. | id | A_NUMBER |
  49. | item_type | file |
  50. | item_source | A_NUMBER |
  51. | share_type | 9 |
  52. | file_source | A_NUMBER |
  53. | path | /textfile0.txt |
  54. | permissions | 19 |
  55. | stime | A_NUMBER |
  56. | storage | A_NUMBER |
  57. | mail_send | 0 |
  58. | uid_owner | gs-user0 |
  59. | storage_id | home::gs-user0 |
  60. | file_parent | A_NUMBER |
  61. | displayname_owner | gs-user0 |
  62. | share_with | group1@REMOTE |
  63. | share_with_displayname | group1@REMOTE |
  64. Scenario: Federate share a file with local server
  65. Given Using server "LOCAL"
  66. And user "user0" exists
  67. And Using server "REMOTE"
  68. And user "user1" exists
  69. When User "user1" from server "REMOTE" shares "/textfile0.txt" with user "user0" from server "LOCAL"
  70. Then the OCS status code should be "100"
  71. And the HTTP status code should be "200"
  72. And Share fields of last share match with
  73. | id | A_NUMBER |
  74. | item_type | file |
  75. | item_source | A_NUMBER |
  76. | share_type | 6 |
  77. | file_source | A_NUMBER |
  78. | path | /textfile0.txt |
  79. | permissions | 19 |
  80. | stime | A_NUMBER |
  81. | storage | A_NUMBER |
  82. | mail_send | 0 |
  83. | uid_owner | user1 |
  84. | storage_id | home::user1 |
  85. | file_parent | A_NUMBER |
  86. | displayname_owner | user1 |
  87. | share_with | user0@LOCAL |
  88. | share_with_displayname | user0 |
  89. Scenario: Remote sharee can see the pending share
  90. Given Using server "REMOTE"
  91. And user "user1" exists
  92. And Using server "LOCAL"
  93. And user "user0" exists
  94. And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
  95. And Using server "REMOTE"
  96. And As an "user1"
  97. When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
  98. Then the OCS status code should be "100"
  99. And the HTTP status code should be "200"
  100. And Share fields of last share match with
  101. | id | A_NUMBER |
  102. | remote | LOCAL |
  103. | remote_id | A_NUMBER |
  104. | share_token | A_TOKEN |
  105. | name | /textfile0.txt |
  106. | owner | user0 |
  107. | user | user1 |
  108. | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
  109. | accepted | 0 |
  110. Scenario: Remote sharee can see the pending group share
  111. Given Using server "REMOTE"
  112. And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
  113. And user "gs-user1" exists
  114. And user "gs-user2" exists
  115. And group "group1" exists
  116. And As an "admin"
  117. And Add user "gs-user1" to the group "group1"
  118. And Add user "gs-user2" to the group "group1"
  119. And Using server "LOCAL"
  120. And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
  121. And user "gs-user0" exists
  122. When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
  123. And Using server "REMOTE"
  124. And As an "gs-user1"
  125. When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
  126. Then the OCS status code should be "100"
  127. And the HTTP status code should be "200"
  128. And Share fields of last share match with
  129. | id | A_NUMBER |
  130. | remote | LOCAL |
  131. | remote_id | A_NUMBER |
  132. | share_token | A_TOKEN |
  133. | name | /textfile0.txt |
  134. | owner | gs-user0 |
  135. | user | group1 |
  136. | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
  137. | accepted | 0 |
  138. And As an "gs-user2"
  139. When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
  140. Then the OCS status code should be "100"
  141. And the HTTP status code should be "200"
  142. And Share fields of last share match with
  143. | id | A_NUMBER |
  144. | remote | LOCAL |
  145. | remote_id | A_NUMBER |
  146. | share_token | A_TOKEN |
  147. | name | /textfile0.txt |
  148. | owner | gs-user0 |
  149. | user | group1 |
  150. | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
  151. | accepted | 0 |
  152. Scenario: accept a pending remote share
  153. Given Using server "REMOTE"
  154. And user "user1" exists
  155. And Using server "LOCAL"
  156. And user "user0" exists
  157. And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
  158. When User "user1" from server "REMOTE" accepts last pending share
  159. Then the OCS status code should be "100"
  160. And the HTTP status code should be "200"
  161. Scenario: accept a pending remote group share
  162. Given Using server "REMOTE"
  163. And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
  164. And user "gs-user1" exists
  165. And user "gs-user2" exists
  166. And group "group1" exists
  167. And As an "admin"
  168. And Add user "gs-user1" to the group "group1"
  169. And Add user "gs-user2" to the group "group1"
  170. And Using server "LOCAL"
  171. And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
  172. And user "gs-user0" exists
  173. When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
  174. When User "gs-user1" from server "REMOTE" accepts last pending share
  175. Then the OCS status code should be "100"
  176. And the HTTP status code should be "200"
  177. Scenario: Reshare a federated shared file
  178. Given Using server "REMOTE"
  179. And user "user1" exists
  180. And user "user2" exists
  181. And Using server "LOCAL"
  182. And user "user0" exists
  183. And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
  184. And User "user1" from server "REMOTE" accepts last pending share
  185. And Using server "REMOTE"
  186. And As an "user1"
  187. When creating a share with
  188. | path | /textfile0 (2).txt |
  189. | shareType | 0 |
  190. | shareWith | user2 |
  191. | permissions | 19 |
  192. #Then the OCS status code should be "100"
  193. #And the HTTP status code should be "200"
  194. #And Share fields of last share match with
  195. # | id | A_NUMBER |
  196. # | item_type | file |
  197. # | item_source | A_NUMBER |
  198. # | share_type | 0 |
  199. # | file_source | A_NUMBER |
  200. # | path | /textfile0 (2).txt |
  201. # | permissions | 19 |
  202. # | stime | A_NUMBER |
  203. # | storage | A_NUMBER |
  204. # | mail_send | 1 |
  205. # | uid_owner | user1 |
  206. # | file_parent | A_NUMBER |
  207. # | displayname_owner | user1 |
  208. # | share_with | user2 |
  209. # | share_with_displayname | user2 |
  210. Scenario: Overwrite a federated shared file as recipient
  211. Given Using server "REMOTE"
  212. And user "user1" exists
  213. And user "user2" exists
  214. And Using server "LOCAL"
  215. And user "user0" exists
  216. And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
  217. And User "user1" from server "REMOTE" accepts last pending share
  218. And Using server "REMOTE"
  219. And As an "user1"
  220. And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA"
  221. When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/textfile0 (2).txt"
  222. And Downloading file "/textfile0 (2).txt" with range "bytes=0-8"
  223. Then Downloaded content should be "BLABLABLA"
  224. Scenario: Overwrite a federated shared folder as recipient
  225. Given Using server "REMOTE"
  226. And user "user1" exists
  227. And user "user2" exists
  228. And Using server "LOCAL"
  229. And user "user0" exists
  230. And User "user0" from server "LOCAL" shares "/PARENT" with user "user1" from server "REMOTE"
  231. And User "user1" from server "REMOTE" accepts last pending share
  232. And Using server "REMOTE"
  233. And As an "user1"
  234. And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA"
  235. #When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/PARENT (2)/textfile0.txt"
  236. #And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8"
  237. #Then Downloaded content should be "BLABLABLA"
  238. Scenario: List federated share from another server not accepted yet
  239. Given Using server "LOCAL"
  240. And user "user0" exists
  241. Given Using server "REMOTE"
  242. And user "user1" exists
  243. # Rename file so it has a unique name in the target server (as the target
  244. # server may have its own /textfile0.txt" file)
  245. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  246. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  247. And Using server "LOCAL"
  248. When As an "user0"
  249. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  250. Then the list of returned shares has 0 shares
  251. Scenario: List federated share from another server
  252. Given Using server "LOCAL"
  253. And user "user0" exists
  254. Given Using server "REMOTE"
  255. And user "user1" exists
  256. # Rename file so it has a unique name in the target server (as the target
  257. # server may have its own /textfile0.txt" file)
  258. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  259. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  260. And Using server "LOCAL"
  261. And User "user0" from server "LOCAL" accepts last pending share
  262. When As an "user0"
  263. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  264. Then the list of returned shares has 1 shares
  265. And remote share 0 is returned with
  266. | remote | http://localhost:8180/ |
  267. | name | /remote-share.txt |
  268. | owner | user1 |
  269. | user | user0 |
  270. | mountpoint | /remote-share.txt |
  271. | mimetype | text/plain |
  272. | mtime | A_NUMBER |
  273. | permissions | 27 |
  274. | type | file |
  275. | file_id | A_NUMBER |
  276. Scenario: List federated share from another server no longer reachable
  277. Given Using server "LOCAL"
  278. And user "user0" exists
  279. Given Using server "REMOTE"
  280. And user "user1" exists
  281. # Rename file so it has a unique name in the target server (as the target
  282. # server may have its own /textfile0.txt" file)
  283. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  284. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  285. And Using server "LOCAL"
  286. And User "user0" from server "LOCAL" accepts last pending share
  287. And remote server is stopped
  288. When As an "user0"
  289. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  290. Then the list of returned shares has 1 shares
  291. And remote share 0 is returned with
  292. | remote | http://localhost:8180/ |
  293. | name | /remote-share.txt |
  294. | owner | user1 |
  295. | user | user0 |
  296. | mountpoint | /remote-share.txt |
  297. Scenario: List federated share from another server no longer reachable after caching the file entry
  298. Given Using server "LOCAL"
  299. And user "user0" exists
  300. Given Using server "REMOTE"
  301. And user "user1" exists
  302. # Rename file so it has a unique name in the target server (as the target
  303. # server may have its own /textfile0.txt" file)
  304. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  305. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  306. And Using server "LOCAL"
  307. And User "user0" from server "LOCAL" accepts last pending share
  308. # Checking that the file exists caches the file entry, which causes an
  309. # exception to be thrown when getting the file info if the remote server is
  310. # unreachable.
  311. And as "user0" the file "/remote-share.txt" exists
  312. And remote server is stopped
  313. When As an "user0"
  314. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  315. Then the list of returned shares has 1 shares
  316. And remote share 0 is returned with
  317. | remote | http://localhost:8180/ |
  318. | name | /remote-share.txt |
  319. | owner | user1 |
  320. | user | user0 |
  321. | mountpoint | /remote-share.txt |
  322. Scenario: Delete federated share with another server
  323. Given Using server "LOCAL"
  324. And user "user0" exists
  325. Given Using server "REMOTE"
  326. And user "user1" exists
  327. # Rename file so it has a unique name in the target server (as the target
  328. # server may have its own /textfile0.txt" file)
  329. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  330. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  331. And As an "user1"
  332. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  333. And the list of returned shares has 1 shares
  334. And Using server "LOCAL"
  335. And User "user0" from server "LOCAL" accepts last pending share
  336. And as "user0" the file "/remote-share.txt" exists
  337. And As an "user0"
  338. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  339. And the list of returned shares has 1 shares
  340. And Using server "REMOTE"
  341. When As an "user1"
  342. And Deleting last share
  343. Then the OCS status code should be "100"
  344. And the HTTP status code should be "200"
  345. And As an "user1"
  346. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  347. And the list of returned shares has 0 shares
  348. And Using server "LOCAL"
  349. And as "user0" the file "/remote-share.txt" does not exist
  350. And As an "user0"
  351. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  352. And the list of returned shares has 0 shares
  353. Scenario: Delete federated share from another server
  354. Given Using server "LOCAL"
  355. And user "user0" exists
  356. Given Using server "REMOTE"
  357. And user "user1" exists
  358. # Rename file so it has a unique name in the target server (as the target
  359. # server may have its own /textfile0.txt" file)
  360. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  361. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  362. And As an "user1"
  363. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  364. And the list of returned shares has 1 shares
  365. And Using server "LOCAL"
  366. And User "user0" from server "LOCAL" accepts last pending share
  367. And as "user0" the file "/remote-share.txt" exists
  368. And As an "user0"
  369. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  370. And the list of returned shares has 1 shares
  371. When user "user0" deletes last accepted remote share
  372. Then the OCS status code should be "100"
  373. And the HTTP status code should be "200"
  374. And as "user0" the file "/remote-share.txt" does not exist
  375. And As an "user0"
  376. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  377. And the list of returned shares has 0 shares
  378. And Using server "REMOTE"
  379. And As an "user1"
  380. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  381. And the list of returned shares has 0 shares
  382. Scenario: Delete federated share from another server no longer reachable
  383. Given Using server "LOCAL"
  384. And user "user0" exists
  385. Given Using server "REMOTE"
  386. And user "user1" exists
  387. # Rename file so it has a unique name in the target server (as the target
  388. # server may have its own /textfile0.txt" file)
  389. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  390. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  391. And Using server "LOCAL"
  392. And User "user0" from server "LOCAL" accepts last pending share
  393. And as "user0" the file "/remote-share.txt" exists
  394. And As an "user0"
  395. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  396. And the list of returned shares has 1 shares
  397. And remote server is stopped
  398. When user "user0" deletes last accepted remote share
  399. Then the OCS status code should be "100"
  400. And the HTTP status code should be "200"
  401. And as "user0" the file "/remote-share.txt" does not exist
  402. And As an "user0"
  403. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  404. And the list of returned shares has 0 shares
  405. Scenario: Delete federated share file from another server
  406. Given Using server "LOCAL"
  407. And user "user0" exists
  408. Given Using server "REMOTE"
  409. And user "user1" exists
  410. # Rename file so it has a unique name in the target server (as the target
  411. # server may have its own /textfile0.txt" file)
  412. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  413. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  414. And As an "user1"
  415. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  416. And the list of returned shares has 1 shares
  417. And Using server "LOCAL"
  418. And User "user0" from server "LOCAL" accepts last pending share
  419. And as "user0" the file "/remote-share.txt" exists
  420. And As an "user0"
  421. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  422. And the list of returned shares has 1 shares
  423. When User "user0" deletes file "/remote-share.txt"
  424. Then the HTTP status code should be "204"
  425. And as "user0" the file "/remote-share.txt" does not exist
  426. And As an "user0"
  427. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  428. And the list of returned shares has 0 shares
  429. And Using server "REMOTE"
  430. And As an "user1"
  431. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  432. And the list of returned shares has 0 shares
  433. Scenario: Delete federated share file from another server no longer reachable
  434. Given Using server "LOCAL"
  435. And user "user0" exists
  436. Given Using server "REMOTE"
  437. And user "user1" exists
  438. # Rename file so it has a unique name in the target server (as the target
  439. # server may have its own /textfile0.txt" file)
  440. And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
  441. And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
  442. And Using server "LOCAL"
  443. And User "user0" from server "LOCAL" accepts last pending share
  444. And as "user0" the file "/remote-share.txt" exists
  445. And As an "user0"
  446. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  447. And the list of returned shares has 1 shares
  448. And remote server is stopped
  449. When User "user0" deletes file "/remote-share.txt"
  450. Then the HTTP status code should be "204"
  451. And as "user0" the file "/remote-share.txt" does not exist
  452. And As an "user0"
  453. And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
  454. And the list of returned shares has 0 shares