sharing-v1-part2.feature 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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: Get a share with a user which didn't received the share
  242. Given user "user0" exists
  243. And user "user1" exists
  244. And user "user2" exists
  245. And file "textfile0.txt" of user "user0" is shared with user "user1"
  246. And As an "user2"
  247. When Getting info of last share
  248. Then the OCS status code should be "404"
  249. And the HTTP status code should be "200"
  250. Scenario: Share of folder and sub-folder to same user - core#20645
  251. Given As an "admin"
  252. And user "user0" exists
  253. And user "user1" exists
  254. And group "group0" exists
  255. And user "user1" belongs to group "group0"
  256. And file "/PARENT" of user "user0" is shared with user "user1"
  257. When file "/PARENT/CHILD" of user "user0" is shared with group "group0"
  258. Then user "user1" should see following elements
  259. | /FOLDER/ |
  260. | /PARENT/ |
  261. | /PARENT/CHILD/ |
  262. | /PARENT/parent.txt |
  263. | /PARENT/CHILD/child.txt |
  264. | /PARENT%20(2)/ |
  265. | /PARENT%20(2)/CHILD/ |
  266. | /PARENT%20(2)/parent.txt |
  267. | /PARENT%20(2)/CHILD/child.txt |
  268. | /CHILD/ |
  269. | /CHILD/child.txt |
  270. And the HTTP status code should be "200"
  271. Scenario: Share a file by multiple channels
  272. Given As an "admin"
  273. And user "user0" exists
  274. And user "user1" exists
  275. And user "user2" exists
  276. And group "group0" exists
  277. And user "user1" belongs to group "group0"
  278. And user "user2" belongs to group "group0"
  279. And user "user0" created a folder "/common"
  280. And user "user0" created a folder "/common/sub"
  281. And file "common" of user "user0" is shared with group "group0"
  282. And file "textfile0.txt" of user "user1" is shared with user "user2"
  283. And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt"
  284. And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt"
  285. And As an "user2"
  286. When Downloading file "/common/sub/textfile0.txt" with range "bytes=10-18"
  287. Then Downloaded content should be "test text"
  288. And Downloaded content when downloading file "/textfile0.txt" with range "bytes=10-18" should be "test text"
  289. And user "user2" should see following elements
  290. | /common/sub/textfile0.txt |
  291. Scenario: Share a file by multiple channels
  292. Given As an "admin"
  293. And user "user0" exists
  294. And user "user1" exists
  295. And user "user2" exists
  296. And group "group0" exists
  297. And user "user1" belongs to group "group0"
  298. And user "user2" belongs to group "group0"
  299. And user "user0" created a folder "/common"
  300. And user "user0" created a folder "/common/sub"
  301. And file "common" of user "user0" is shared with group "group0"
  302. And file "textfile0.txt" of user "user1" is shared with user "user2"
  303. And User "user1" moved file "/textfile0.txt" to "/common/textfile0.txt"
  304. And User "user1" moved file "/common/textfile0.txt" to "/common/sub/textfile0.txt"
  305. And As an "user2"
  306. When Downloading file "/textfile0 (2).txt" with range "bytes=10-18"
  307. Then Downloaded content should be "test text"
  308. And user "user2" should see following elements
  309. | /common/sub/textfile0.txt |
  310. Scenario: Delete all group shares
  311. Given As an "admin"
  312. And user "user0" exists
  313. And user "user1" exists
  314. And group "group1" exists
  315. And user "user1" belongs to group "group1"
  316. And file "textfile0.txt" of user "user0" is shared with group "group1"
  317. And User "user1" moved file "/textfile0 (2).txt" to "/FOLDER/textfile0.txt"
  318. And As an "user0"
  319. And Deleting last share
  320. And As an "user1"
  321. When sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  322. Then the OCS status code should be "100"
  323. And the HTTP status code should be "200"
  324. And last share_id is not included in the answer
  325. Scenario: delete a share
  326. Given user "user0" exists
  327. And user "user1" exists
  328. And file "textfile0.txt" of user "user0" is shared with user "user1"
  329. And As an "user0"
  330. When Deleting last share
  331. Then the OCS status code should be "100"
  332. And the HTTP status code should be "200"
  333. Scenario: Keep usergroup shares (#22143)
  334. Given As an "admin"
  335. And user "user0" exists
  336. And user "user1" exists
  337. And user "user2" exists
  338. And group "group" exists
  339. And user "user1" belongs to group "group"
  340. And user "user2" belongs to group "group"
  341. And user "user0" created a folder "/TMP"
  342. And file "TMP" of user "user0" is shared with group "group"
  343. And user "user1" created a folder "/myFOLDER"
  344. And User "user1" moves file "/TMP" to "/myFOLDER/myTMP"
  345. And user "user2" does not exist
  346. And user "user1" should see following elements
  347. | /myFOLDER/myTMP/ |
  348. Scenario: Check quota of owners parent directory of a shared file
  349. Given using old dav path
  350. And As an "admin"
  351. And user "user0" exists
  352. And user "user1" exists
  353. And user "user1" has a quota of "0"
  354. And User "user0" moved file "/welcome.txt" to "/myfile.txt"
  355. And file "myfile.txt" of user "user0" is shared with user "user1"
  356. When User "user1" uploads file "data/textfile.txt" to "/myfile.txt"
  357. Then the HTTP status code should be "204"
  358. Scenario: Don't allow sharing of the root
  359. Given user "user0" exists
  360. And As an "user0"
  361. When creating a share with
  362. | path | / |
  363. | shareType | 3 |
  364. Then the OCS status code should be "403"
  365. Scenario: Allow modification of reshare
  366. Given user "user0" exists
  367. And user "user1" exists
  368. And user "user2" exists
  369. And user "user0" created a folder "/TMP"
  370. And file "TMP" of user "user0" is shared with user "user1"
  371. And file "TMP" of user "user1" is shared with user "user2"
  372. And As an "user1"
  373. When Updating last share with
  374. | permissions | 1 |
  375. Then the OCS status code should be "100"
  376. Scenario: Do not allow reshare to exceed permissions
  377. Given user "user0" exists
  378. And user "user1" exists
  379. And user "user2" exists
  380. And user "user0" created a folder "/TMP"
  381. And As an "user0"
  382. And creating a share with
  383. | path | /TMP |
  384. | shareType | 0 |
  385. | shareWith | user1 |
  386. | permissions | 21 |
  387. And As an "user1"
  388. And creating a share with
  389. | path | /TMP |
  390. | shareType | 0 |
  391. | shareWith | user2 |
  392. | permissions | 21 |
  393. When Updating last share with
  394. | permissions | 31 |
  395. Then the OCS status code should be "404"
  396. Scenario: Only allow 1 link share per file/folder
  397. Given user "user0" exists
  398. And As an "user0"
  399. And creating a share with
  400. | path | welcome.txt |
  401. | shareType | 3 |
  402. When save last share id
  403. And creating a share with
  404. | path | welcome.txt |
  405. | shareType | 3 |
  406. Then share ids should match
  407. Scenario: Correct webdav share-permissions for owned file
  408. Given user "user0" exists
  409. And User "user0" uploads file with content "foo" to "/tmp.txt"
  410. When as "user0" gets properties of folder "/tmp.txt" with
  411. |{http://open-collaboration-services.org/ns}share-permissions |
  412. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "19"
  413. # See sharing-v1-part3.feature