sharing-v1-part2.feature 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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: Share of folder and sub-folder to same user - core#20645
  309. Given As an "admin"
  310. And user "user0" exists
  311. And user "user1" exists
  312. And group "group0" exists
  313. And user "user1" belongs to group "group0"
  314. And file "/PARENT" of user "user0" is shared with user "user1"
  315. When file "/PARENT/CHILD" of user "user0" is shared with group "group0"
  316. Then user "user1" should see following elements
  317. | /FOLDER/ |
  318. | /PARENT/ |
  319. | /PARENT/CHILD/ |
  320. | /PARENT/parent.txt |
  321. | /PARENT/CHILD/child.txt |
  322. | /PARENT%20(2)/ |
  323. | /PARENT%20(2)/CHILD/ |
  324. | /PARENT%20(2)/parent.txt |
  325. | /PARENT%20(2)/CHILD/child.txt |
  326. | /CHILD/ |
  327. | /CHILD/child.txt |
  328. And the HTTP status code should be "200"
  329. Scenario: Share a file by multiple channels
  330. Given As an "admin"
  331. And user "user0" exists
  332. And user "user1" exists
  333. And user "user2" exists
  334. And group "group0" exists
  335. And user "user1" belongs to group "group0"
  336. And user "user2" belongs to group "group0"
  337. And user "user0" created a folder "/common"
  338. And user "user0" created a folder "/common/sub"
  339. And file "common" of user "user0" is shared with group "group0"
  340. And file "textfile0.txt" of user "user1" is shared with user "user2"
  341. And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt"
  342. And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt"
  343. And As an "user2"
  344. When Downloading file "/common/sub/textfile0.txt" with range "bytes=10-18"
  345. Then Downloaded content should be "test text"
  346. And Downloaded content when downloading file "/textfile0.txt" with range "bytes=10-18" should be "test text"
  347. And user "user2" should see following elements
  348. | /common/sub/textfile0.txt |
  349. Scenario: Share a file by multiple channels
  350. Given As an "admin"
  351. And user "user0" exists
  352. And user "user1" exists
  353. And user "user2" exists
  354. And group "group0" exists
  355. And user "user1" belongs to group "group0"
  356. And user "user2" belongs to group "group0"
  357. And user "user0" created a folder "/common"
  358. And user "user0" created a folder "/common/sub"
  359. And file "common" of user "user0" is shared with group "group0"
  360. And file "textfile0.txt" of user "user1" is shared with user "user2"
  361. And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt"
  362. And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt"
  363. And As an "user2"
  364. When Downloading file "/textfile0 (2).txt" with range "bytes=10-18"
  365. Then Downloaded content should be "test text"
  366. And user "user2" should see following elements
  367. | /common/sub/textfile0.txt |
  368. Scenario: Delete all group shares
  369. Given As an "admin"
  370. And user "user0" exists
  371. And user "user1" exists
  372. And group "group1" exists
  373. And user "user1" belongs to group "group1"
  374. And file "textfile0.txt" of user "user0" is shared with group "group1"
  375. And User "user1" moved file "/textfile0 (2).txt" to "/FOLDER/textfile0.txt"
  376. And As an "user0"
  377. And Deleting last share
  378. And As an "user1"
  379. When sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  380. Then the OCS status code should be "100"
  381. And the HTTP status code should be "200"
  382. And last share_id is not included in the answer
  383. Scenario: delete a share
  384. Given user "user0" exists
  385. And user "user1" exists
  386. And file "textfile0.txt" of user "user0" is shared with user "user1"
  387. And As an "user0"
  388. When Deleting last share
  389. Then the OCS status code should be "100"
  390. And the HTTP status code should be "200"
  391. Scenario: Keep usergroup shares (#22143)
  392. Given As an "admin"
  393. And user "user0" exists
  394. And user "user1" exists
  395. And user "user2" exists
  396. And group "group" exists
  397. And user "user1" belongs to group "group"
  398. And user "user2" belongs to group "group"
  399. And user "user0" created a folder "/TMP"
  400. And file "TMP" of user "user0" is shared with group "group"
  401. And user "user1" created a folder "/myFOLDER"
  402. And User "user1" moves file "/TMP" to "/myFOLDER/myTMP"
  403. And user "user2" does not exist
  404. And user "user1" should see following elements
  405. | /myFOLDER/myTMP/ |
  406. Scenario: Check quota of owners parent directory of a shared file
  407. Given using old dav path
  408. And As an "admin"
  409. And user "user0" exists
  410. And user "user1" exists
  411. And user "user1" has a quota of "0"
  412. And User "user0" moved file "/welcome.txt" to "/myfile.txt"
  413. And file "myfile.txt" of user "user0" is shared with user "user1"
  414. When User "user1" uploads file "data/textfile.txt" to "/myfile.txt"
  415. Then the HTTP status code should be "204"
  416. Scenario: Don't allow sharing of the root
  417. Given user "user0" exists
  418. And As an "user0"
  419. When creating a share with
  420. | path | / |
  421. | shareType | 3 |
  422. Then the OCS status code should be "403"
  423. Scenario: Allow modification of reshare
  424. Given user "user0" exists
  425. And user "user1" exists
  426. And user "user2" exists
  427. And user "user0" created a folder "/TMP"
  428. And file "TMP" of user "user0" is shared with user "user1"
  429. And file "TMP" of user "user1" is shared with user "user2"
  430. And As an "user1"
  431. When Updating last share with
  432. | permissions | 1 |
  433. Then the OCS status code should be "100"
  434. Scenario: Do not allow reshare to exceed permissions
  435. Given user "user0" exists
  436. And user "user1" exists
  437. And user "user2" exists
  438. And user "user0" created a folder "/TMP"
  439. And As an "user0"
  440. And creating a share with
  441. | path | /TMP |
  442. | shareType | 0 |
  443. | shareWith | user1 |
  444. | permissions | 21 |
  445. And As an "user1"
  446. And creating a share with
  447. | path | /TMP |
  448. | shareType | 0 |
  449. | shareWith | user2 |
  450. | permissions | 21 |
  451. When Updating last share with
  452. | permissions | 31 |
  453. Then the OCS status code should be "404"
  454. Scenario: Do not allow sub reshare to exceed permissions
  455. Given user "user0" exists
  456. And user "user1" exists
  457. And user "user2" exists
  458. And user "user0" created a folder "/TMP"
  459. And user "user0" created a folder "/TMP/SUB"
  460. And As an "user0"
  461. And creating a share with
  462. | path | /TMP |
  463. | shareType | 0 |
  464. | shareWith | user1 |
  465. | permissions | 21 |
  466. And As an "user1"
  467. And creating a share with
  468. | path | /TMP/SUB |
  469. | shareType | 0 |
  470. | shareWith | user2 |
  471. | permissions | 21 |
  472. When Updating last share with
  473. | permissions | 31 |
  474. Then the OCS status code should be "404"
  475. Scenario: Only allow 1 link share per file/folder
  476. Given user "user0" exists
  477. And As an "user0"
  478. And creating a share with
  479. | path | welcome.txt |
  480. | shareType | 3 |
  481. When save last share id
  482. And creating a share with
  483. | path | welcome.txt |
  484. | shareType | 3 |
  485. Then share ids should match
  486. Scenario: Correct webdav share-permissions for owned file
  487. Given user "user0" exists
  488. And User "user0" uploads file with content "foo" to "/tmp.txt"
  489. When as "user0" gets properties of folder "/tmp.txt" with
  490. |{http://open-collaboration-services.org/ns}share-permissions |
  491. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "19"
  492. # See sharing-v1-part3.feature