sharing-v1-part3.feature 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. Feature: sharing
  2. Background:
  3. Given using api version "1"
  4. Given using new dav path
  5. # See sharing-v1-part2.feature
  6. Scenario: Correct webdav share-permissions for received file with edit and reshare permissions
  7. Given user "user0" exists
  8. And user "user1" exists
  9. And User "user0" uploads file with content "foo" to "/tmp.txt"
  10. And file "/tmp.txt" of user "user0" is shared with user "user1"
  11. When as "user1" gets properties of folder "/tmp.txt" with
  12. |{http://open-collaboration-services.org/ns}share-permissions |
  13. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "19"
  14. Scenario: Correct webdav share-permissions for received file with edit permissions but no reshare permissions
  15. Given user "user0" exists
  16. And user "user1" exists
  17. And User "user0" uploads file with content "foo" to "/tmp.txt"
  18. And file "tmp.txt" of user "user0" is shared with user "user1"
  19. And As an "user0"
  20. And Updating last share with
  21. | permissions | 3 |
  22. When as "user1" gets properties of folder "/tmp.txt" with
  23. |{http://open-collaboration-services.org/ns}share-permissions |
  24. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "3"
  25. Scenario: Correct webdav share-permissions for received file with reshare permissions but no edit permissions
  26. Given user "user0" exists
  27. And user "user1" exists
  28. And User "user0" uploads file with content "foo" to "/tmp.txt"
  29. And file "tmp.txt" of user "user0" is shared with user "user1"
  30. And As an "user0"
  31. And Updating last share with
  32. | permissions | 17 |
  33. When as "user1" gets properties of folder "/tmp.txt" with
  34. |{http://open-collaboration-services.org/ns}share-permissions |
  35. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "17"
  36. Scenario: Correct webdav share-permissions for owned folder
  37. Given user "user0" exists
  38. And user "user0" created a folder "/tmp"
  39. When as "user0" gets properties of folder "/" with
  40. |{http://open-collaboration-services.org/ns}share-permissions |
  41. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "31"
  42. Scenario: Correct webdav share-permissions for received folder with all permissions
  43. Given user "user0" exists
  44. And user "user1" exists
  45. And user "user0" created a folder "/tmp"
  46. And file "/tmp" of user "user0" is shared with user "user1"
  47. When as "user1" gets properties of folder "/tmp" with
  48. |{http://open-collaboration-services.org/ns}share-permissions |
  49. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "31"
  50. Scenario: Correct webdav share-permissions for received folder with all permissions but edit
  51. Given user "user0" exists
  52. And user "user1" exists
  53. And user "user0" created a folder "/tmp"
  54. And file "/tmp" of user "user0" is shared with user "user1"
  55. And As an "user0"
  56. And Updating last share with
  57. | permissions | 29 |
  58. When as "user1" gets properties of folder "/tmp" with
  59. |{http://open-collaboration-services.org/ns}share-permissions |
  60. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "29"
  61. Scenario: Correct webdav share-permissions for received folder with all permissions but create
  62. Given user "user0" exists
  63. And user "user1" exists
  64. And user "user0" created a folder "/tmp"
  65. And file "/tmp" of user "user0" is shared with user "user1"
  66. And As an "user0"
  67. And Updating last share with
  68. | permissions | 27 |
  69. When as "user1" gets properties of folder "/tmp" with
  70. |{http://open-collaboration-services.org/ns}share-permissions |
  71. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "27"
  72. Scenario: Correct webdav share-permissions for received folder with all permissions but delete
  73. Given user "user0" exists
  74. And user "user1" exists
  75. And user "user0" created a folder "/tmp"
  76. And file "/tmp" of user "user0" is shared with user "user1"
  77. And As an "user0"
  78. And Updating last share with
  79. | permissions | 23 |
  80. When as "user1" gets properties of folder "/tmp" with
  81. |{http://open-collaboration-services.org/ns}share-permissions |
  82. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "23"
  83. Scenario: Correct webdav share-permissions for received folder with all permissions but share
  84. Given user "user0" exists
  85. And user "user1" exists
  86. And user "user0" created a folder "/tmp"
  87. And file "/tmp" of user "user0" is shared with user "user1"
  88. And As an "user0"
  89. And Updating last share with
  90. | permissions | 15 |
  91. When as "user1" gets properties of folder "/tmp" with
  92. |{http://open-collaboration-services.org/ns}share-permissions |
  93. Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "15"
  94. Scenario: unique target names for incoming shares
  95. Given user "user0" exists
  96. And user "user1" exists
  97. And user "user2" exists
  98. And user "user0" created a folder "/foo"
  99. And user "user1" created a folder "/foo"
  100. When file "/foo" of user "user0" is shared with user "user2"
  101. And file "/foo" of user "user1" is shared with user "user2"
  102. Then user "user2" should see following elements
  103. | /foo/ |
  104. | /foo%20(2)/ |
  105. Scenario: Creating a new share with a disabled user
  106. Given As an "admin"
  107. And user "user0" exists
  108. And user "user1" exists
  109. And assure user "user0" is disabled
  110. And As an "user0"
  111. When sending "POST" to "/apps/files_sharing/api/v1/shares" with
  112. | path | welcome.txt |
  113. | shareWith | user1 |
  114. | shareType | 0 |
  115. Then the OCS status code should be "997"
  116. And the HTTP status code should be "401"
  117. Scenario: Deleting a group share as user
  118. Given As an "admin"
  119. And user "user0" exists
  120. And user "user1" exists
  121. And group "group1" exists
  122. And user "user1" belongs to group "group1"
  123. And As an "user0"
  124. And creating a share with
  125. | path | welcome.txt |
  126. | shareType | 1 |
  127. | shareWith | group1 |
  128. When As an "user1"
  129. And Deleting last share
  130. Then the OCS status code should be "100"
  131. And the HTTP status code should be "200"
  132. Scenario: Merging shares for recipient when shared from outside with group and member
  133. Given using old dav path
  134. And As an "admin"
  135. And user "user0" exists
  136. And user "user1" exists
  137. And group "group1" exists
  138. And user "user1" belongs to group "group1"
  139. And user "user0" created a folder "/merge-test-outside"
  140. When folder "/merge-test-outside" of user "user0" is shared with group "group1"
  141. And folder "/merge-test-outside" of user "user0" is shared with user "user1"
  142. Then as "user1" the folder "/merge-test-outside" exists
  143. And as "user1" the folder "/merge-test-outside (2)" does not exist
  144. Scenario: Merging shares for recipient when shared from outside with group and member with different permissions
  145. Given As an "admin"
  146. And user "user0" exists
  147. And user "user1" exists
  148. And group "group1" exists
  149. And user "user1" belongs to group "group1"
  150. And user "user0" created a folder "/merge-test-outside-perms"
  151. When folder "/merge-test-outside-perms" of user "user0" is shared with group "group1" with permissions 1
  152. And folder "/merge-test-outside-perms" of user "user0" is shared with user "user1" with permissions 31
  153. Then as "user1" gets properties of folder "/merge-test-outside-perms" with
  154. |{http://owncloud.org/ns}permissions|
  155. And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
  156. And as "user1" the folder "/merge-test-outside-perms (2)" does not exist
  157. Scenario: Merging shares for recipient when shared from outside with two groups
  158. Given As an "admin"
  159. And user "user0" exists
  160. And user "user1" exists
  161. And group "group1" exists
  162. And group "group2" exists
  163. And user "user1" belongs to group "group1"
  164. And user "user1" belongs to group "group2"
  165. And user "user0" created a folder "/merge-test-outside-twogroups"
  166. When folder "/merge-test-outside-twogroups" of user "user0" is shared with group "group1"
  167. And folder "/merge-test-outside-twogroups" of user "user0" is shared with group "group2"
  168. Then as "user1" the folder "/merge-test-outside-twogroups" exists
  169. And as "user1" the folder "/merge-test-outside-twogroups (2)" does not exist
  170. Scenario: Merging shares for recipient when shared from outside with two groups with different permissions
  171. Given As an "admin"
  172. And user "user0" exists
  173. And user "user1" exists
  174. And group "group1" exists
  175. And group "group2" exists
  176. And user "user1" belongs to group "group1"
  177. And user "user1" belongs to group "group2"
  178. And user "user0" created a folder "/merge-test-outside-twogroups-perms"
  179. When folder "/merge-test-outside-twogroups-perms" of user "user0" is shared with group "group1" with permissions 1
  180. And folder "/merge-test-outside-twogroups-perms" of user "user0" is shared with group "group2" with permissions 31
  181. Then as "user1" gets properties of folder "/merge-test-outside-twogroups-perms" with
  182. |{http://owncloud.org/ns}permissions|
  183. And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
  184. And as "user1" the folder "/merge-test-outside-twogroups-perms (2)" does not exist
  185. Scenario: Merging shares for recipient when shared from outside with two groups and member
  186. Given As an "admin"
  187. And user "user0" exists
  188. And user "user1" exists
  189. And group "group1" exists
  190. And group "group2" exists
  191. And user "user1" belongs to group "group1"
  192. And user "user1" belongs to group "group2"
  193. And user "user0" created a folder "/merge-test-outside-twogroups-member-perms"
  194. When folder "/merge-test-outside-twogroups-member-perms" of user "user0" is shared with group "group1" with permissions 1
  195. And folder "/merge-test-outside-twogroups-member-perms" of user "user0" is shared with group "group2" with permissions 31
  196. And folder "/merge-test-outside-twogroups-member-perms" of user "user0" is shared with user "user1" with permissions 1
  197. Then as "user1" gets properties of folder "/merge-test-outside-twogroups-member-perms" with
  198. |{http://owncloud.org/ns}permissions|
  199. And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
  200. And as "user1" the folder "/merge-test-outside-twogroups-member-perms (2)" does not exist
  201. Scenario: Merging shares for recipient when shared from inside with group
  202. Given As an "admin"
  203. And user "user0" exists
  204. And group "group1" exists
  205. And user "user0" belongs to group "group1"
  206. And user "user0" created a folder "/merge-test-inside-group"
  207. When folder "/merge-test-inside-group" of user "user0" is shared with group "group1"
  208. Then as "user0" the folder "/merge-test-inside-group" exists
  209. And as "user0" the folder "/merge-test-inside-group (2)" does not exist
  210. Scenario: Merging shares for recipient when shared from inside with two groups
  211. Given As an "admin"
  212. And user "user0" exists
  213. And group "group1" exists
  214. And group "group2" exists
  215. And user "user0" belongs to group "group1"
  216. And user "user0" belongs to group "group2"
  217. And user "user0" created a folder "/merge-test-inside-twogroups"
  218. When folder "/merge-test-inside-twogroups" of user "user0" is shared with group "group1"
  219. And folder "/merge-test-inside-twogroups" of user "user0" is shared with group "group2"
  220. Then as "user0" the folder "/merge-test-inside-twogroups" exists
  221. And as "user0" the folder "/merge-test-inside-twogroups (2)" does not exist
  222. And as "user0" the folder "/merge-test-inside-twogroups (3)" does not exist
  223. Scenario: Merging shares for recipient when shared from inside with group with less permissions
  224. Given As an "admin"
  225. And user "user0" exists
  226. And group "group1" exists
  227. And group "group2" exists
  228. And user "user0" belongs to group "group1"
  229. And user "user0" belongs to group "group2"
  230. And user "user0" created a folder "/merge-test-inside-twogroups-perms"
  231. When folder "/merge-test-inside-twogroups-perms" of user "user0" is shared with group "group1"
  232. And folder "/merge-test-inside-twogroups-perms" of user "user0" is shared with group "group2"
  233. Then as "user0" gets properties of folder "/merge-test-inside-twogroups-perms" with
  234. |{http://owncloud.org/ns}permissions|
  235. And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "RGDNVCK"
  236. And as "user0" the folder "/merge-test-inside-twogroups-perms (2)" does not exist
  237. And as "user0" the folder "/merge-test-inside-twogroups-perms (3)" does not exist
  238. Scenario: Merging shares for recipient when shared from outside with group then user and recipient renames in between
  239. Given As an "admin"
  240. And user "user0" exists
  241. And user "user1" exists
  242. And group "group1" exists
  243. And user "user1" belongs to group "group1"
  244. And user "user0" created a folder "/merge-test-outside-groups-renamebeforesecondshare"
  245. When folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with group "group1"
  246. And User "user1" moved folder "/merge-test-outside-groups-renamebeforesecondshare" to "/merge-test-outside-groups-renamebeforesecondshare-renamed"
  247. And Sleep for "1" seconds
  248. And folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with user "user1"
  249. Then as "user1" gets properties of folder "/merge-test-outside-groups-renamebeforesecondshare-renamed" with
  250. |{http://owncloud.org/ns}permissions|
  251. And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
  252. And as "user1" the folder "/merge-test-outside-groups-renamebeforesecondshare" does not exist
  253. Scenario: Merging shares for recipient when shared from outside with user then group and recipient renames in between
  254. Given using old dav path
  255. Given As an "admin"
  256. And user "user0" exists
  257. And user "user1" exists
  258. And group "group1" exists
  259. And user "user1" belongs to group "group1"
  260. And user "user0" created a folder "/merge-test-outside-groups-renamebeforesecondshare"
  261. When folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with user "user1"
  262. And User "user1" moved folder "/merge-test-outside-groups-renamebeforesecondshare" to "/merge-test-outside-groups-renamebeforesecondshare-renamed"
  263. And Sleep for "1" seconds
  264. And folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with group "group1"
  265. Then as "user1" gets properties of folder "/merge-test-outside-groups-renamebeforesecondshare-renamed" with
  266. |{http://owncloud.org/ns}permissions|
  267. And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRGDNVCK"
  268. And as "user1" the folder "/merge-test-outside-groups-renamebeforesecondshare" does not exist
  269. Scenario: Empting trashbin
  270. Given As an "admin"
  271. And user "user0" exists
  272. And User "user0" deletes file "/textfile0.txt"
  273. When User "user0" empties trashbin
  274. Then the HTTP status code should be "204"
  275. Scenario: orphaned shares
  276. Given As an "admin"
  277. And user "user0" exists
  278. And user "user1" exists
  279. And user "user0" created a folder "/common"
  280. And user "user0" created a folder "/common/sub"
  281. And file "/common/sub" of user "user0" is shared with user "user1"
  282. And User "user0" deletes folder "/common"
  283. When User "user0" empties trashbin
  284. Then as "user1" the folder "/sub" does not exist
  285. Scenario: sharing again an own file while belonging to a group
  286. Given As an "admin"
  287. Given user "user0" exists
  288. And group "sharing-group" exists
  289. And user "user0" belongs to group "sharing-group"
  290. And file "welcome.txt" of user "user0" is shared with group "sharing-group"
  291. And Deleting last share
  292. When sending "POST" to "/apps/files_sharing/api/v1/shares" with
  293. | path | welcome.txt |
  294. | shareWith | sharing-group |
  295. | shareType | 1 |
  296. Then the OCS status code should be "100"
  297. And the HTTP status code should be "200"
  298. Scenario: unshare from self
  299. Given As an "admin"
  300. And user "user0" exists
  301. And user "user1" exists
  302. And group "sharing-group" exists
  303. And user "user0" belongs to group "sharing-group"
  304. And user "user1" belongs to group "sharing-group"
  305. And file "/PARENT/parent.txt" of user "user0" is shared with group "sharing-group"
  306. And user "user0" stores etag of element "/PARENT"
  307. And user "user1" stores etag of element "/"
  308. And As an "user1"
  309. When Deleting last share
  310. Then etag of element "/" of user "user1" has changed
  311. And etag of element "/PARENT" of user "user0" has not changed
  312. Scenario: do not allow to increase link share permissions on reshare
  313. Given As an "admin"
  314. And user "user0" exists
  315. And user "user1" exists
  316. And user "user0" created a folder "/TMP"
  317. And As an "user0"
  318. And creating a share with
  319. | path | TMP |
  320. | shareType | 0 |
  321. | shareWith | user1 |
  322. | permissions | 17 |
  323. When As an "user1"
  324. And creating a share with
  325. | path | TMP |
  326. | shareType | 3 |
  327. And Updating last share with
  328. | publicUpload | true |
  329. Then the OCS status code should be "404"
  330. And the HTTP status code should be "200"
  331. Scenario: do not allow to increase link share permissions on sub reshare
  332. Given As an "admin"
  333. And user "user0" exists
  334. And user "user1" exists
  335. And user "user0" created a folder "/TMP"
  336. And user "user0" created a folder "/TMP/SUB"
  337. And As an "user0"
  338. And creating a share with
  339. | path | TMP |
  340. | shareType | 0 |
  341. | shareWith | user1 |
  342. | permissions | 17 |
  343. When As an "user1"
  344. And creating a share with
  345. | path | TMP/SUB |
  346. | shareType | 3 |
  347. And Updating last share with
  348. | publicUpload | true |
  349. Then the OCS status code should be "404"
  350. And the HTTP status code should be "200"
  351. Scenario: deleting file out of a share as recipient creates a backup for the owner
  352. Given As an "admin"
  353. And user "user0" exists
  354. And user "user1" exists
  355. And user "user0" created a folder "/shared"
  356. And User "user0" moved file "/textfile0.txt" to "/shared/shared_file.txt"
  357. And folder "/shared" of user "user0" is shared with user "user1"
  358. When User "user1" deletes file "/shared/shared_file.txt"
  359. Then as "user1" the file "/shared/shared_file.txt" does not exist
  360. And as "user0" the file "/shared/shared_file.txt" does not exist
  361. And as "user0" the file "/shared_file.txt" exists in trash
  362. And as "user1" the file "/shared_file.txt" exists in trash
  363. Scenario: deleting folder out of a share as recipient creates a backup for the owner
  364. Given As an "admin"
  365. And user "user0" exists
  366. And user "user1" exists
  367. And user "user0" created a folder "/shared"
  368. And user "user0" created a folder "/shared/sub"
  369. And User "user0" moved file "/textfile0.txt" to "/shared/sub/shared_file.txt"
  370. And folder "/shared" of user "user0" is shared with user "user1"
  371. When User "user1" deletes folder "/shared/sub"
  372. Then as "user1" the folder "/shared/sub" does not exist
  373. And as "user0" the folder "/shared/sub" does not exist
  374. And as "user0" the folder "/sub" exists in trash
  375. And as "user0" the file "/sub/shared_file.txt" exists in trash
  376. And as "user1" the folder "/sub" exists in trash
  377. And as "user1" the file "/sub/shared_file.txt" exists in trash
  378. Scenario: moving a file into a share as recipient
  379. Given As an "admin"
  380. And user "user0" exists
  381. And user "user1" exists
  382. And user "user0" created a folder "/shared"
  383. And folder "/shared" of user "user0" is shared with user "user1"
  384. When User "user1" moved file "/textfile0.txt" to "/shared/shared_file.txt"
  385. Then as "user1" the file "/shared/shared_file.txt" exists
  386. And as "user0" the file "/shared/shared_file.txt" exists
  387. Scenario: Link shares inside of group shares keep their original data when the root share is updated
  388. Given As an "admin"
  389. And user "user0" exists
  390. And user "user1" exists
  391. And group "group1" exists
  392. And user "user1" belongs to group "group1"
  393. And As an "user0"
  394. And user "user0" created a folder "/share"
  395. And folder "/share" of user "user0" is shared with group "group1"
  396. And user "user0" created a folder "/share/subfolder"
  397. And As an "user1"
  398. And save the last share data as "original"
  399. And as "user1" creating a share with
  400. | path | /share/subfolder |
  401. | shareType | 3 |
  402. | permissions | 31 |
  403. And save the last share data as "link"
  404. And As an "user0"
  405. And restore the last share data from "original"
  406. When Updating last share with
  407. | permissions | 23 |
  408. | expireDate | +3 days |
  409. And restore the last share data from "link"
  410. And Getting info of last share
  411. And Share fields of last share match with
  412. | id | A_NUMBER |
  413. | item_source | A_NUMBER |
  414. | share_type | 3 |
  415. | permissions | 23 |
  416. | file_target | /subfolder |
  417. | expireDate | |