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.

sharing-v1-part2.feature 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. Feature: sharing
  2. Background:
  3. Given using api version "1"
  4. Given using old dav path
  5. # See sharing-v1.feature
  6. Scenario: getting all shares of a file with reshares
  7. Given user "user0" exists
  8. And user "user1" exists
  9. And user "user2" exists
  10. And user "user3" exists
  11. And file "textfile0.txt" of user "user0" is shared with user "user1"
  12. And file "textfile0 (2).txt" of user "user1" is shared with user "user2"
  13. And As an "user0"
  14. When sending "GET" to "/apps/files_sharing/api/v1/shares?reshares=true&path=textfile0.txt"
  15. Then the OCS status code should be "100"
  16. And the HTTP status code should be "200"
  17. And User "user1" should be included in the response
  18. And User "user2" should be included in the response
  19. And User "user3" should not be included in the response
  20. Scenario: Reshared files can be still accessed if a user in the middle removes it.
  21. Given user "user0" exists
  22. And user "user1" exists
  23. And user "user2" exists
  24. And user "user3" exists
  25. And file "textfile0.txt" of user "user0" is shared with user "user1"
  26. And file "textfile0 (2).txt" of user "user1" is shared with user "user2"
  27. And file "textfile0 (2).txt" of user "user2" is shared with user "user3"
  28. And As an "user1"
  29. When User "user1" deletes file "/textfile0 (2).txt"
  30. And As an "user3"
  31. And Downloading file "/textfile0 (2).txt" with range "bytes=1-8"
  32. Then Downloaded content should be "extcloud"
  33. Scenario: getting share info of a share
  34. Given user "user0" exists
  35. And user "user1" exists
  36. And file "textfile0.txt" of user "user0" is shared with user "user1"
  37. And As an "user0"
  38. When Getting info of last share
  39. Then the OCS status code should be "100"
  40. And the HTTP status code should be "200"
  41. And Share fields of last share match with
  42. | id | A_NUMBER |
  43. | item_type | file |
  44. | item_source | A_NUMBER |
  45. | share_type | 0 |
  46. | share_with | user1 |
  47. | file_source | A_NUMBER |
  48. | file_target | /textfile0.txt |
  49. | path | /textfile0.txt |
  50. | permissions | 19 |
  51. | stime | A_NUMBER |
  52. | storage | A_NUMBER |
  53. | mail_send | 0 |
  54. | uid_owner | user0 |
  55. | storage_id | home::user0 |
  56. | file_parent | A_NUMBER |
  57. | share_with_displayname | user1 |
  58. | displayname_owner | user0 |
  59. | mimetype | text/plain |
  60. Scenario: getting share info of a group share
  61. Given user "user0" exists
  62. And user "user1" exists
  63. And group "group1" exists
  64. And user "user1" belongs to group "group1"
  65. And file "textfile0.txt" of user "user0" is shared with group "group1"
  66. And As an "user0"
  67. When Getting info of last share
  68. Then the OCS status code should be "100"
  69. And the HTTP status code should be "200"
  70. And Share fields of last share match with
  71. | id | A_NUMBER |
  72. | item_type | file |
  73. | item_source | A_NUMBER |
  74. | share_type | 1 |
  75. | share_with | group1 |
  76. | file_source | A_NUMBER |
  77. | file_target | /textfile0.txt |
  78. | path | /textfile0.txt |
  79. | permissions | 19 |
  80. | stime | A_NUMBER |
  81. | storage | A_NUMBER |
  82. | mail_send | 0 |
  83. | uid_owner | user0 |
  84. | storage_id | home::user0 |
  85. | file_parent | A_NUMBER |
  86. | share_with_displayname | group1 |
  87. | displayname_owner | user0 |
  88. | mimetype | text/plain |
  89. And As an "user1"
  90. And Getting info of last share
  91. And the OCS status code should be "100"
  92. And the HTTP status code should be "200"
  93. And Share fields of last share match with
  94. | id | A_NUMBER |
  95. | item_type | file |
  96. | item_source | A_NUMBER |
  97. | share_type | 1 |
  98. | share_with | group1 |
  99. | file_source | A_NUMBER |
  100. | file_target | /textfile0 (2).txt |
  101. | path | /textfile0 (2).txt |
  102. | permissions | 19 |
  103. | stime | A_NUMBER |
  104. | storage | A_NUMBER |
  105. | mail_send | 0 |
  106. | uid_owner | user0 |
  107. | storage_id | shared::/textfile0 (2).txt |
  108. | file_parent | A_NUMBER |
  109. | share_with_displayname | group1 |
  110. | displayname_owner | user0 |
  111. | mimetype | text/plain |
  112. Scenario: keep group permissions in sync
  113. Given As an "admin"
  114. Given user "user0" exists
  115. And user "user1" exists
  116. And group "group1" exists
  117. And user "user1" belongs to group "group1"
  118. And file "textfile0.txt" of user "user0" is shared with group "group1"
  119. And User "user1" moved file "/textfile0 (2).txt" to "/FOLDER/textfile0.txt"
  120. And As an "user0"
  121. When Updating last share with
  122. | permissions | 1 |
  123. And Getting info of last share
  124. Then the OCS status code should be "100"
  125. And the HTTP status code should be "200"
  126. And Share fields of last share match with
  127. | id | A_NUMBER |
  128. | item_type | file |
  129. | item_source | A_NUMBER |
  130. | share_type | 1 |
  131. | file_source | A_NUMBER |
  132. | file_target | /textfile0.txt |
  133. | permissions | 1 |
  134. | stime | A_NUMBER |
  135. | storage | A_NUMBER |
  136. | mail_send | 0 |
  137. | uid_owner | user0 |
  138. | storage_id | home::user0 |
  139. | file_parent | A_NUMBER |
  140. | displayname_owner | user0 |
  141. | mimetype | text/plain |
  142. And As an "user1"
  143. And Getting info of last share
  144. And the OCS status code should be "100"
  145. And the HTTP status code should be "200"
  146. And Share fields of last share match with
  147. | id | A_NUMBER |
  148. | item_type | file |
  149. | item_source | A_NUMBER |
  150. | share_type | 1 |
  151. | file_source | A_NUMBER |
  152. | file_target | /FOLDER/textfile0.txt |
  153. | permissions | 1 |
  154. | stime | A_NUMBER |
  155. | storage | A_NUMBER |
  156. | mail_send | 0 |
  157. | uid_owner | user0 |
  158. | storage_id | shared::/FOLDER/textfile0.txt |
  159. | file_parent | A_NUMBER |
  160. | displayname_owner | user0 |
  161. | mimetype | text/plain |
  162. Scenario: Sharee can see the share
  163. Given user "user0" exists
  164. And user "user1" exists
  165. And file "textfile0.txt" of user "user0" is shared with user "user1"
  166. And As an "user1"
  167. When sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  168. Then the OCS status code should be "100"
  169. And the HTTP status code should be "200"
  170. And last share_id is included in the answer
  171. Scenario: Sharee can see the filtered share
  172. Given user "user0" exists
  173. And user "user1" exists
  174. And file "textfile0.txt" of user "user0" is shared with user "user1"
  175. And file "textfile1.txt" of user "user0" is shared with user "user1"
  176. And As an "user1"
  177. When sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true&path=textfile1 (2).txt"
  178. Then the OCS status code should be "100"
  179. And the HTTP status code should be "200"
  180. And last share_id is included in the answer
  181. Scenario: Sharee can't see the share that is filtered out
  182. Given user "user0" exists
  183. And user "user1" exists
  184. And file "textfile0.txt" of user "user0" is shared with user "user1"
  185. And file "textfile1.txt" of user "user0" is shared with user "user1"
  186. And As an "user1"
  187. When sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true&path=textfile0 (2).txt"
  188. Then the OCS status code should be "100"
  189. And the HTTP status code should be "200"
  190. And last share_id is not included in the answer
  191. Scenario: Sharee can see the group share
  192. Given As an "admin"
  193. And user "user0" exists
  194. And user "user1" exists
  195. And group "group0" exists
  196. And user "user1" belongs to group "group0"
  197. And file "textfile0.txt" of user "user0" is shared with group "group0"
  198. And As an "user1"
  199. When sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  200. Then the OCS status code should be "100"
  201. And the HTTP status code should be "200"
  202. And last share_id is included in the answer
  203. Scenario: User is not allowed to reshare file
  204. As an "admin"
  205. Given user "user0" exists
  206. And user "user1" exists
  207. And user "user2" exists
  208. And As an "user0"
  209. And creating a share with
  210. | path | /textfile0.txt |
  211. | shareType | 0 |
  212. | shareWith | user1 |
  213. | permissions | 8 |
  214. And As an "user1"
  215. When creating a share with
  216. | path | /textfile0 (2).txt |
  217. | shareType | 0 |
  218. | shareWith | user2 |
  219. | permissions | 31 |
  220. Then the OCS status code should be "404"
  221. And the HTTP status code should be "200"
  222. Scenario: User is not allowed to reshare file with more permissions
  223. As an "admin"
  224. Given user "user0" exists
  225. And user "user1" exists
  226. And user "user2" exists
  227. And As an "user0"
  228. And creating a share with
  229. | path | /textfile0.txt |
  230. | shareType | 0 |
  231. | shareWith | user1 |
  232. | permissions | 16 |
  233. And As an "user1"
  234. When creating a share with
  235. | path | /textfile0 (2).txt |
  236. | shareType | 0 |
  237. | shareWith | user2 |
  238. | permissions | 31 |
  239. Then the OCS status code should be "404"
  240. And the HTTP status code should be "200"
  241. Scenario: User is not allowed to reshare file with additional delete permissions
  242. As an "admin"
  243. Given user "user0" exists
  244. And user "user1" exists
  245. And user "user2" exists
  246. And As an "user0"
  247. And creating a share with
  248. | path | /PARENT |
  249. | shareType | 0 |
  250. | shareWith | user1 |
  251. | permissions | 16 |
  252. And As an "user1"
  253. When creating a share with
  254. | path | /PARENT (2) |
  255. | shareType | 0 |
  256. | shareWith | user2 |
  257. | permissions | 25 |
  258. Then the OCS status code should be "404"
  259. And the HTTP status code should be "200"
  260. Scenario: User is not allowed to reshare file with additional delete permissions for files
  261. As an "admin"
  262. Given user "user0" exists
  263. And user "user1" exists
  264. And user "user2" exists
  265. And As an "user0"
  266. And creating a share with
  267. | path | /textfile0.txt |
  268. | shareType | 0 |
  269. | shareWith | user1 |
  270. | permissions | 16 |
  271. And As an "user1"
  272. When creating a share with
  273. | path | /textfile0 (2).txt |
  274. | shareType | 0 |
  275. | shareWith | user2 |
  276. | permissions | 25 |
  277. Then the OCS status code should be "100"
  278. And the HTTP status code should be "200"
  279. When Getting info of last share
  280. Then Share fields of last share match with
  281. | id | A_NUMBER |
  282. | item_type | file |
  283. | item_source | A_NUMBER |
  284. | share_type | 0 |
  285. | share_with | user2 |
  286. | file_source | A_NUMBER |
  287. | file_target | /textfile0 (2).txt |
  288. | path | /textfile0 (2).txt |
  289. | permissions | 17 |
  290. | stime | A_NUMBER |
  291. | storage | A_NUMBER |
  292. | mail_send | 0 |
  293. | uid_owner | user1 |
  294. | storage_id | shared::/textfile0 (2).txt |
  295. | file_parent | A_NUMBER |
  296. | share_with_displayname | user2 |
  297. | displayname_owner | user1 |
  298. | mimetype | text/plain |
  299. Scenario: Get a share with a user which didn't received the share
  300. Given user "user0" exists
  301. And user "user1" exists
  302. And user "user2" exists
  303. And file "textfile0.txt" of user "user0" is shared with user "user1"
  304. And As an "user2"
  305. When Getting info of last share
  306. Then the OCS status code should be "404"
  307. And the HTTP status code should be "200"
  308. Scenario: Get a share with a user with resharing rights
  309. Given user "user0" exists
  310. And user "user1" exists
  311. And user "user2" exists
  312. And file "textfile0.txt" of user "user0" is shared with user "user1"
  313. And file "textfile0.txt" of user "user0" is shared with user "user2"
  314. And As an "user1"
  315. When Getting info of last share
  316. Then the OCS status code should be "100"
  317. And the HTTP status code should be "200"
  318. And Share fields of last share match with
  319. | id | A_NUMBER |
  320. | item_type | file |
  321. | item_source | A_NUMBER |
  322. | share_type | 0 |
  323. | share_with | user2 |
  324. | file_source | A_NUMBER |
  325. | file_target | /textfile0.txt |
  326. | path | /textfile0 (2).txt |
  327. | permissions | 19 |
  328. | stime | A_NUMBER |
  329. | storage | A_NUMBER |
  330. | mail_send | 0 |
  331. | uid_owner | user0 |
  332. | storage_id | shared::/textfile0 (2).txt |
  333. | file_parent | A_NUMBER |
  334. | share_with_displayname | user2 |
  335. | displayname_owner | user0 |
  336. | mimetype | text/plain |
  337. Scenario: Share of folder and sub-folder to same user - core#20645
  338. Given As an "admin"
  339. And user "user0" exists
  340. And user "user1" exists
  341. And group "group0" exists
  342. And user "user1" belongs to group "group0"
  343. And file "/PARENT" of user "user0" is shared with user "user1"
  344. When file "/PARENT/CHILD" of user "user0" is shared with group "group0"
  345. Then user "user1" should see following elements
  346. | /FOLDER/ |
  347. | /PARENT/ |
  348. | /PARENT/CHILD/ |
  349. | /PARENT/parent.txt |
  350. | /PARENT/CHILD/child.txt |
  351. | /PARENT%20(2)/ |
  352. | /PARENT%20(2)/CHILD/ |
  353. | /PARENT%20(2)/parent.txt |
  354. | /PARENT%20(2)/CHILD/child.txt |
  355. | /CHILD/ |
  356. | /CHILD/child.txt |
  357. And the HTTP status code should be "200"
  358. Scenario: Share a file by multiple channels
  359. Given As an "admin"
  360. And user "user0" exists
  361. And user "user1" exists
  362. And user "user2" exists
  363. And group "group0" exists
  364. And user "user1" belongs to group "group0"
  365. And user "user2" belongs to group "group0"
  366. And user "user0" created a folder "/common"
  367. And user "user0" created a folder "/common/sub"
  368. And file "common" of user "user0" is shared with group "group0"
  369. And file "textfile0.txt" of user "user1" is shared with user "user2"
  370. And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt"
  371. And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt"
  372. And As an "user2"
  373. When Downloading file "/common/sub/textfile0.txt" with range "bytes=10-18"
  374. Then Downloaded content should be "test text"
  375. And Downloaded content when downloading file "/textfile0.txt" with range "bytes=10-18" should be "test text"
  376. And user "user2" should see following elements
  377. | /common/sub/textfile0.txt |
  378. Scenario: Share a file by multiple channels
  379. Given As an "admin"
  380. And user "user0" exists
  381. And user "user1" exists
  382. And user "user2" exists
  383. And group "group0" exists
  384. And user "user1" belongs to group "group0"
  385. And user "user2" belongs to group "group0"
  386. And user "user0" created a folder "/common"
  387. And user "user0" created a folder "/common/sub"
  388. And file "common" of user "user0" is shared with group "group0"
  389. And file "textfile0.txt" of user "user1" is shared with user "user2"
  390. And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt"
  391. And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt"
  392. And As an "user2"
  393. When Downloading file "/textfile0 (2).txt" with range "bytes=10-18"
  394. Then Downloaded content should be "test text"
  395. And user "user2" should see following elements
  396. | /common/sub/textfile0.txt |
  397. Scenario: Delete all group shares
  398. Given As an "admin"
  399. And user "user0" exists
  400. And user "user1" exists
  401. And group "group1" exists
  402. And user "user1" belongs to group "group1"
  403. And file "textfile0.txt" of user "user0" is shared with group "group1"
  404. And User "user1" moved file "/textfile0 (2).txt" to "/FOLDER/textfile0.txt"
  405. And As an "user0"
  406. And Deleting last share
  407. And As an "user1"
  408. When sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  409. Then the OCS status code should be "100"
  410. And the HTTP status code should be "200"
  411. And last share_id is not included in the answer
  412. Scenario: delete a share
  413. Given user "user0" exists
  414. And user "user1" exists
  415. And file "textfile0.txt" of user "user0" is shared with user "user1"
  416. And As an "user0"
  417. When Deleting last share
  418. Then the OCS status code should be "100"
  419. And the HTTP status code should be "200"
  420. Scenario: delete a share with a user that didn't receive the share
  421. Given user "user0" exists
  422. And user "user1" exists
  423. And user "user2" exists
  424. And file "textfile0.txt" of user "user0" is shared with user "user1"
  425. And As an "user2"
  426. When Deleting last share
  427. Then the OCS status code should be "404"
  428. And the HTTP status code should be "200"
  429. Scenario: delete a share with a user with resharing rights that didn't receive the share
  430. Given user "user0" exists
  431. And user "user1" exists
  432. And user "user2" exists
  433. And file "textfile0.txt" of user "user0" is shared with user "user1"
  434. And file "textfile0.txt" of user "user0" is shared with user "user2"
  435. And As an "user1"
  436. When Deleting last share
  437. Then the OCS status code should be "403"
  438. And the HTTP status code should be "401"
  439. Scenario: Keep usergroup shares (#22143)
  440. Given As an "admin"
  441. And user "user0" exists
  442. And user "user1" exists
  443. And user "user2" exists
  444. And group "group" exists
  445. And user "user1" belongs to group "group"
  446. And user "user2" belongs to group "group"
  447. And user "user0" created a folder "/TMP"
  448. And file "TMP" of user "user0" is shared with group "group"
  449. And user "user1" created a folder "/myFOLDER"
  450. And User "user1" moves file "/TMP" to "/myFOLDER/myTMP"
  451. And user "user2" does not exist
  452. And user "user1" should see following elements
  453. | /myFOLDER/myTMP/ |
  454. Scenario: Check quota of owners parent directory of a shared file
  455. Given using old dav path
  456. And As an "admin"
  457. And user "user0" exists
  458. And user "user1" exists
  459. And user "user1" has a quota of "0"
  460. And User "user0" moved file "/welcome.txt" to "/myfile.txt"
  461. And file "myfile.txt" of user "user0" is shared with user "user1"
  462. When User "user1" uploads file "data/textfile.txt" to "/myfile.txt"
  463. Then the HTTP status code should be "204"
  464. Scenario: Don't allow sharing of the root
  465. Given user "user0" exists
  466. And As an "user0"
  467. When creating a share with
  468. | path | / |
  469. | shareType | 3 |
  470. Then the OCS status code should be "403"
  471. Scenario: Allow modification of reshare
  472. Given user "user0" exists
  473. And user "user1" exists
  474. And user "user2" exists
  475. And user "user0" created a folder "/TMP"
  476. And file "TMP" of user "user0" is shared with user "user1"
  477. And file "TMP" of user "user1" is shared with user "user2"
  478. And As an "user1"
  479. When Updating last share with
  480. | permissions | 1 |
  481. Then the OCS status code should be "100"
  482. And the HTTP status code should be "200"
  483. Scenario: Do not allow reshare to exceed permissions
  484. Given user "user0" exists
  485. And user "user1" exists
  486. And user "user2" exists
  487. And user "user0" created a folder "/TMP"
  488. And As an "user0"
  489. And creating a share with
  490. | path | /TMP |
  491. | shareType | 0 |
  492. | shareWith | user1 |
  493. | permissions | 21 |
  494. And As an "user1"
  495. And creating a share with
  496. | path | /TMP |
  497. | shareType | 0 |
  498. | shareWith | user2 |
  499. | permissions | 21 |
  500. When Updating last share with
  501. | permissions | 31 |
  502. Then the OCS status code should be "404"
  503. And the HTTP status code should be "200"
  504. Scenario: Do not allow sub reshare to exceed permissions
  505. Given user "user0" exists
  506. And user "user1" exists
  507. And user "user2" exists
  508. And user "user0" created a folder "/TMP"
  509. And user "user0" created a folder "/TMP/SUB"
  510. And As an "user0"
  511. And creating a share with
  512. | path | /TMP |
  513. | shareType | 0 |
  514. | shareWith | user1 |
  515. | permissions | 21 |
  516. And As an "user1"
  517. And creating a share with
  518. | path | /TMP/SUB |
  519. | shareType | 0 |
  520. | shareWith | user2 |
  521. | permissions | 21 |
  522. When Updating last share with
  523. | permissions | 31 |
  524. Then the OCS status code should be "404"
  525. And the HTTP status code should be "200"
  526. Scenario: Only allow 1 link share per file/folder
  527. Given user "user0" exists
  528. And As an "user0"
  529. And creating a share with
  530. | path | welcome.txt |
  531. | shareType | 3 |
  532. When save last share id
  533. And creating a share with
  534. | path | welcome.txt |
  535. | shareType | 3 |
  536. Then share ids should match
  537. Scenario: Correct webdav share-permissions for owned file
  538. Given user "user0" exists
  539. And User "user0" uploads file with content "foo" to "/tmp.txt"
  540. When as "user0" gets properties of folder "/tmp.txt" with
  541. |{http://open-collaboration-services.org/ns}share-permissions |
  542. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "19"
  543. # See sharing-v1-part3.feature