1
0

sharing-v1.feature 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. Feature: sharing
  2. Background:
  3. Given using api version "1"
  4. Given using old dav path
  5. Scenario: Creating a new share with user
  6. Given user "user0" exists
  7. And user "user1" exists
  8. And As an "user0"
  9. When creating a share with
  10. | path | welcome.txt |
  11. | shareWith | user1 |
  12. | shareType | 0 |
  13. Then the OCS status code should be "100"
  14. And the HTTP status code should be "200"
  15. And The following headers should be set
  16. | Content-Security-Policy | default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none' |
  17. Scenario: Creating a share with a group
  18. Given user "user0" exists
  19. And user "user1" exists
  20. And group "sharing-group" exists
  21. And As an "user0"
  22. When creating a share with
  23. | path | welcome.txt |
  24. | shareWith | sharing-group |
  25. | shareType | 1 |
  26. Then the OCS status code should be "100"
  27. And the HTTP status code should be "200"
  28. Scenario: Creating a new share with user who already received a share through their group
  29. Given As an "admin"
  30. And user "user0" exists
  31. And user "user1" exists
  32. And group "sharing-group" exists
  33. And user "user1" belongs to group "sharing-group"
  34. And file "welcome.txt" of user "user0" is shared with group "sharing-group"
  35. And user "user1" accepts last share
  36. And As an "user0"
  37. Then creating a share with
  38. | path | welcome.txt |
  39. | shareWith | user1 |
  40. | shareType | 0 |
  41. Then the OCS status code should be "100"
  42. And the HTTP status code should be "200"
  43. Scenario: Creating a new room share when Talk is not enabled
  44. Given As an "admin"
  45. And app "spreed" is not enabled
  46. And user "user0" exists
  47. And As an "user0"
  48. When creating a share with
  49. | path | welcome.txt |
  50. | shareWith | a-room-token |
  51. | shareType | 10 |
  52. Then the OCS status code should be "403"
  53. And the HTTP status code should be "200"
  54. Scenario: Creating a new mail share
  55. Given dummy mail server is listening
  56. And user "user0" exists
  57. And As an "user0"
  58. When creating a share with
  59. | path | welcome.txt |
  60. | shareType | 4 |
  61. | shareWith | dumy@test.com |
  62. Then the OCS status code should be "100"
  63. And the HTTP status code should be "200"
  64. And last share can be downloaded
  65. Scenario: Creating a new mail share with password
  66. Given dummy mail server is listening
  67. And user "user0" exists
  68. And As an "user0"
  69. When creating a share with
  70. | path | welcome.txt |
  71. | shareType | 4 |
  72. | shareWith | dumy@test.com |
  73. | password | publicpw |
  74. Then the OCS status code should be "100"
  75. And the HTTP status code should be "200"
  76. And last share with password "publicpw" can be downloaded
  77. Scenario: Creating a new mail share with password when password protection is enforced
  78. Given dummy mail server is listening
  79. And As an "admin"
  80. And parameter "shareapi_enforce_links_password" of app "core" is set to "yes"
  81. And user "user0" exists
  82. And As an "user0"
  83. When creating a share with
  84. | path | welcome.txt |
  85. | shareType | 4 |
  86. | shareWith | dumy@test.com |
  87. | password | publicpw |
  88. Then the OCS status code should be "100"
  89. And the HTTP status code should be "200"
  90. And last share with password "publicpw" can be downloaded
  91. Scenario: Creating a new mail share and setting a password
  92. Given dummy mail server is listening
  93. And user "user0" exists
  94. And As an "user0"
  95. When creating a share with
  96. | path | welcome.txt |
  97. | shareType | 4 |
  98. | shareWith | dumy@test.com |
  99. And Updating last share with
  100. | password | publicpw |
  101. Then the OCS status code should be "100"
  102. And the HTTP status code should be "200"
  103. And last share with password "publicpw" can be downloaded
  104. Scenario: Creating a new mail share and setting a password twice
  105. Given dummy mail server is listening
  106. And user "user0" exists
  107. And As an "user0"
  108. When creating a share with
  109. | path | welcome.txt |
  110. | shareType | 4 |
  111. | shareWith | dumy@test.com |
  112. And Updating last share with
  113. | password | publicpw |
  114. And Updating last share with
  115. | password | another publicpw |
  116. Then the OCS status code should be "100"
  117. And the HTTP status code should be "200"
  118. And last share with password "another publicpw" can be downloaded
  119. Scenario: Creating a new mail share and setting the same password twice
  120. Given dummy mail server is listening
  121. And user "user0" exists
  122. And As an "user0"
  123. When creating a share with
  124. | path | welcome.txt |
  125. | shareType | 4 |
  126. | shareWith | dumy@test.com |
  127. And Updating last share with
  128. | password | publicpw |
  129. And Updating last share with
  130. | password | publicpw |
  131. Then the OCS status code should be "100"
  132. And the HTTP status code should be "200"
  133. And last share with password "publicpw" can be downloaded
  134. Scenario: Creating a new public share
  135. Given user "user0" exists
  136. And As an "user0"
  137. When creating a share with
  138. | path | welcome.txt |
  139. | shareType | 3 |
  140. Then the OCS status code should be "100"
  141. And the HTTP status code should be "200"
  142. And last link share can be downloaded
  143. Scenario: Creating a new public share with password
  144. Given user "user0" exists
  145. And As an "user0"
  146. When creating a share with
  147. | path | welcome.txt |
  148. | shareType | 3 |
  149. | password | publicpw |
  150. Then the OCS status code should be "100"
  151. And the HTTP status code should be "200"
  152. And last share with password "publicpw" can be downloaded
  153. Scenario: Creating a new public share of a folder
  154. Given user "user0" exists
  155. And As an "user0"
  156. When creating a share with
  157. | path | FOLDER |
  158. | shareType | 3 |
  159. | password | publicpw |
  160. | expireDate | +3 days |
  161. | publicUpload | true |
  162. | permissions | 7 |
  163. Then the OCS status code should be "100"
  164. And the HTTP status code should be "200"
  165. And Share fields of last share match with
  166. | id | A_NUMBER |
  167. | permissions | 31 |
  168. | expiration | +3 days |
  169. | url | AN_URL |
  170. | token | A_TOKEN |
  171. | mimetype | httpd/unix-directory |
  172. Scenario: Creating a new public share with password and adding an expiration date
  173. Given user "user0" exists
  174. And As an "user0"
  175. When creating a share with
  176. | path | welcome.txt |
  177. | shareType | 3 |
  178. | password | publicpw |
  179. And Updating last share with
  180. | expireDate | +3 days |
  181. Then the OCS status code should be "100"
  182. And the HTTP status code should be "200"
  183. And last share with password "publicpw" can be downloaded
  184. Scenario: Creating a new public share, updating its expiration date and getting its info
  185. Given user "user0" exists
  186. And As an "user0"
  187. When creating a share with
  188. | path | FOLDER |
  189. | shareType | 3 |
  190. And Updating last share with
  191. | expireDate | +3 days |
  192. And the OCS status code should be "100"
  193. And the HTTP status code should be "200"
  194. And Getting info of last share
  195. Then the OCS status code should be "100"
  196. And the HTTP status code should be "200"
  197. And Share fields of last share match with
  198. | id | A_NUMBER |
  199. | item_type | folder |
  200. | item_source | A_NUMBER |
  201. | share_type | 3 |
  202. | file_source | A_NUMBER |
  203. | file_target | /FOLDER |
  204. | permissions | 17 |
  205. | stime | A_NUMBER |
  206. | expiration | +3 days |
  207. | token | A_TOKEN |
  208. | storage | A_NUMBER |
  209. | mail_send | 0 |
  210. | uid_owner | user0 |
  211. | storage_id | home::user0 |
  212. | file_parent | A_NUMBER |
  213. | displayname_owner | user0 |
  214. | url | AN_URL |
  215. | mimetype | httpd/unix-directory |
  216. Scenario: Creating a new public share, updating its password and getting its info
  217. Given user "user0" exists
  218. And As an "user0"
  219. When creating a share with
  220. | path | FOLDER |
  221. | shareType | 3 |
  222. And Updating last share with
  223. | password | publicpw |
  224. And the OCS status code should be "100"
  225. And the HTTP status code should be "200"
  226. And Getting info of last share
  227. Then the OCS status code should be "100"
  228. And the HTTP status code should be "200"
  229. And Share fields of last share match with
  230. | id | A_NUMBER |
  231. | item_type | folder |
  232. | item_source | A_NUMBER |
  233. | share_type | 3 |
  234. | file_source | A_NUMBER |
  235. | file_target | /FOLDER |
  236. | permissions | 17 |
  237. | stime | A_NUMBER |
  238. | token | A_TOKEN |
  239. | storage | A_NUMBER |
  240. | mail_send | 0 |
  241. | uid_owner | user0 |
  242. | storage_id | home::user0 |
  243. | file_parent | A_NUMBER |
  244. | displayname_owner | user0 |
  245. | url | AN_URL |
  246. | mimetype | httpd/unix-directory |
  247. Scenario: Creating a new public share, updating its permissions and getting its info
  248. Given user "user0" exists
  249. And As an "user0"
  250. When creating a share with
  251. | path | FOLDER |
  252. | shareType | 3 |
  253. And Updating last share with
  254. | permissions | 7 |
  255. | publicUpload | true |
  256. And the OCS status code should be "100"
  257. And the HTTP status code should be "200"
  258. And Getting info of last share
  259. Then the OCS status code should be "100"
  260. And the HTTP status code should be "200"
  261. And Share fields of last share match with
  262. | id | A_NUMBER |
  263. | item_type | folder |
  264. | item_source | A_NUMBER |
  265. | share_type | 3 |
  266. | file_source | A_NUMBER |
  267. | file_target | /FOLDER |
  268. | permissions | 31 |
  269. | stime | A_NUMBER |
  270. | token | A_TOKEN |
  271. | storage | A_NUMBER |
  272. | mail_send | 0 |
  273. | uid_owner | user0 |
  274. | storage_id | home::user0 |
  275. | file_parent | A_NUMBER |
  276. | displayname_owner | user0 |
  277. | url | AN_URL |
  278. | mimetype | httpd/unix-directory |
  279. Scenario: Creating a new public share, updating its permissions for "hide file list"
  280. Given user "user0" exists
  281. And As an "user0"
  282. When creating a share with
  283. | path | FOLDER |
  284. | shareType | 3 |
  285. And Updating last share with
  286. | permissions | 4 |
  287. And the OCS status code should be "100"
  288. And the HTTP status code should be "200"
  289. And Getting info of last share
  290. Then the OCS status code should be "100"
  291. And the HTTP status code should be "200"
  292. And Share fields of last share match with
  293. | id | A_NUMBER |
  294. | item_type | folder |
  295. | item_source | A_NUMBER |
  296. | share_type | 3 |
  297. | file_source | A_NUMBER |
  298. | file_target | /FOLDER |
  299. | permissions | 4 |
  300. | stime | A_NUMBER |
  301. | token | A_TOKEN |
  302. | storage | A_NUMBER |
  303. | mail_send | 0 |
  304. | uid_owner | user0 |
  305. | storage_id | home::user0 |
  306. | file_parent | A_NUMBER |
  307. | displayname_owner | user0 |
  308. | url | AN_URL |
  309. | mimetype | httpd/unix-directory |
  310. Scenario: Creating a new public share, updating publicUpload option and getting its info
  311. Given user "user0" exists
  312. And As an "user0"
  313. When creating a share with
  314. | path | FOLDER |
  315. | shareType | 3 |
  316. And Updating last share with
  317. | publicUpload | true |
  318. And the OCS status code should be "100"
  319. And the HTTP status code should be "200"
  320. And Getting info of last share
  321. Then the OCS status code should be "100"
  322. And the HTTP status code should be "200"
  323. And Share fields of last share match with
  324. | id | A_NUMBER |
  325. | item_type | folder |
  326. | item_source | A_NUMBER |
  327. | share_type | 3 |
  328. | file_source | A_NUMBER |
  329. | file_target | /FOLDER |
  330. | permissions | 31 |
  331. | stime | A_NUMBER |
  332. | token | A_TOKEN |
  333. | storage | A_NUMBER |
  334. | mail_send | 0 |
  335. | uid_owner | user0 |
  336. | storage_id | home::user0 |
  337. | file_parent | A_NUMBER |
  338. | displayname_owner | user0 |
  339. | url | AN_URL |
  340. | mimetype | httpd/unix-directory |
  341. Scenario: Creating a new share of a file with default permissions
  342. Given user "user0" exists
  343. And user "user1" exists
  344. And As an "user0"
  345. And parameter "shareapi_default_permissions" of app "core" is set to "7"
  346. When creating a share with
  347. | path | welcome.txt |
  348. | shareWith | user1 |
  349. | shareType | 0 |
  350. And the OCS status code should be "100"
  351. And the HTTP status code should be "200"
  352. And Getting info of last share
  353. Then the OCS status code should be "100"
  354. And the HTTP status code should be "200"
  355. And Share fields of last share match with
  356. | permissions | 3 |
  357. Scenario: Creating a new share of a folder with default permissions
  358. Given user "user0" exists
  359. And user "user1" exists
  360. And As an "user0"
  361. And parameter "shareapi_default_permissions" of app "core" is set to "7"
  362. When creating a share with
  363. | path | FOLDER |
  364. | shareWith | user1 |
  365. | shareType | 0 |
  366. And the OCS status code should be "100"
  367. And the HTTP status code should be "200"
  368. And Getting info of last share
  369. Then the OCS status code should be "100"
  370. And the HTTP status code should be "200"
  371. And Share fields of last share match with
  372. | permissions | 7 |
  373. Scenario: Creating a new internal share with default expiration date
  374. Given user "user0" exists
  375. And user "user1" exists
  376. And As an "user0"
  377. And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
  378. And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
  379. When creating a share with
  380. | path | welcome.txt |
  381. | shareWith | user1 |
  382. | shareType | 0 |
  383. And the OCS status code should be "100"
  384. And the HTTP status code should be "200"
  385. And Getting info of last share
  386. Then the OCS status code should be "100"
  387. And the HTTP status code should be "200"
  388. And Share fields of last share match with
  389. | expiration | +3 days |
  390. Scenario: Creating a new internal share with relaxed default expiration date
  391. Given user "user0" exists
  392. And user "user1" exists
  393. And As an "user0"
  394. And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
  395. And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
  396. And parameter "internal_defaultExpDays" of app "core" is set to "1"
  397. When creating a share with
  398. | path | welcome.txt |
  399. | shareWith | user1 |
  400. | shareType | 0 |
  401. And the OCS status code should be "100"
  402. And the HTTP status code should be "200"
  403. And Getting info of last share
  404. Then the OCS status code should be "100"
  405. And the HTTP status code should be "200"
  406. And Share fields of last share match with
  407. | expiration | +1 days |
  408. Scenario: Creating a new internal share with relaxed default expiration date too large
  409. Given user "user0" exists
  410. And user "user1" exists
  411. And As an "user0"
  412. And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
  413. And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
  414. And parameter "internal_defaultExpDays" of app "core" is set to "10"
  415. When creating a share with
  416. | path | welcome.txt |
  417. | shareWith | user1 |
  418. | shareType | 0 |
  419. And the OCS status code should be "100"
  420. And the HTTP status code should be "200"
  421. And Getting info of last share
  422. Then the OCS status code should be "100"
  423. And the HTTP status code should be "200"
  424. And Share fields of last share match with
  425. | expiration | +3 days |
  426. Scenario: Creating a new link share with default expiration date
  427. Given user "user0" exists
  428. And As an "user0"
  429. And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
  430. And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
  431. When creating a share with
  432. | path | welcome.txt |
  433. | shareType | 3 |
  434. And the OCS status code should be "100"
  435. And the HTTP status code should be "200"
  436. And Getting info of last share
  437. Then the OCS status code should be "100"
  438. And the HTTP status code should be "200"
  439. And Share fields of last share match with
  440. | expiration | +3 days |
  441. Scenario: Creating a new link share with relaxed default expiration date
  442. Given user "user0" exists
  443. And As an "user0"
  444. And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
  445. And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
  446. And parameter "link_defaultExpDays" of app "core" is set to "1"
  447. When creating a share with
  448. | path | welcome.txt |
  449. | shareType | 3 |
  450. And the OCS status code should be "100"
  451. And the HTTP status code should be "200"
  452. And Getting info of last share
  453. Then the OCS status code should be "100"
  454. And the HTTP status code should be "200"
  455. And Share fields of last share match with
  456. | expiration | +1 days |
  457. Scenario: Creating a new link share with relaxed default expiration date too large
  458. Given user "user0" exists
  459. And As an "user0"
  460. And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
  461. And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
  462. And parameter "link_defaultExpDays" of app "core" is set to "10"
  463. When creating a share with
  464. | path | welcome.txt |
  465. | shareType | 3 |
  466. And the OCS status code should be "100"
  467. And the HTTP status code should be "200"
  468. And Getting info of last share
  469. Then the OCS status code should be "100"
  470. And the HTTP status code should be "200"
  471. And Share fields of last share match with
  472. | expiration | +3 days |
  473. Scenario: getting all shares of a user using that user
  474. Given user "user0" exists
  475. And user "user1" exists
  476. And file "textfile0.txt" of user "user0" is shared with user "user1"
  477. And As an "user0"
  478. When sending "GET" to "/apps/files_sharing/api/v1/shares"
  479. Then the OCS status code should be "100"
  480. And the HTTP status code should be "200"
  481. And File "textfile0.txt" should be included in the response
  482. Scenario: getting all shares of a user using another user
  483. Given user "user0" exists
  484. And user "user1" exists
  485. And file "textfile0.txt" of user "user0" is shared with user "user1"
  486. And As an "admin"
  487. When sending "GET" to "/apps/files_sharing/api/v1/shares"
  488. Then the OCS status code should be "100"
  489. And the HTTP status code should be "200"
  490. And File "textfile0.txt" should not be included in the response
  491. Scenario: getting all shares of a file
  492. Given user "user0" exists
  493. And user "user1" exists
  494. And user "user2" exists
  495. And user "user3" exists
  496. And file "textfile0.txt" of user "user0" is shared with user "user1"
  497. And file "textfile0.txt" of user "user0" is shared with user "user2"
  498. And As an "user0"
  499. When sending "GET" to "/apps/files_sharing/api/v1/shares?path=textfile0.txt"
  500. Then the OCS status code should be "100"
  501. And the HTTP status code should be "200"
  502. And User "user1" should be included in the response
  503. And User "user2" should be included in the response
  504. And User "user3" should not be included in the response
  505. Scenario: getting all shares of a file with a user with resharing rights but not yourself
  506. Given user "user0" exists
  507. And user "user1" exists
  508. And user "user2" exists
  509. And user "user3" exists
  510. And file "textfile0.txt" of user "user0" is shared with user "user1"
  511. And user "user1" accepts last share
  512. And file "textfile0.txt" of user "user0" is shared with user "user2"
  513. And As an "user1"
  514. When sending "GET" to "/apps/files_sharing/api/v1/shares?path=textfile0 (2).txt&reshares=true"
  515. Then the OCS status code should be "100"
  516. And the HTTP status code should be "200"
  517. And User "user1" should not be included in the response
  518. And User "user2" should be included in the response
  519. And User "user3" should not be included in the response
  520. Scenario: getting inherited shares of a file
  521. Given user "user0" exists
  522. And user "user1" exists
  523. And user "user2" exists
  524. And user "user3" exists
  525. # will be shared with user1
  526. And User "user0" created a folder "/first"
  527. # will be shared with user1, user2
  528. And User "user0" created a folder "/first/second"
  529. # will be shared with user1, user3
  530. And User "user0" uploads file "data/textfile.txt" to "/first/test1.txt"
  531. # will be shared with user1, user2, user3
  532. And User "user0" uploads file "data/textfile.txt" to "/first/second/test2.txt"
  533. And As an "user0"
  534. And creating a share with
  535. | path | /first |
  536. | shareType | 0 |
  537. | shareWith | user1 |
  538. | permissions | 16 |
  539. And As an "user1"
  540. And accepting last share
  541. And folder "first/second" of user "user0" is shared with user "user2"
  542. And file "first/test1.txt" of user "user0" is shared with user "user3"
  543. And file "first/second/test2.txt" of user "user0" is shared with user "user3"
  544. # get inherited shares from the owner PoV
  545. And As an "user0"
  546. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/second/test2.txt"
  547. Then the OCS status code should be "100"
  548. And the HTTP status code should be "200"
  549. And User "user0" should not be included in the response
  550. And User "user1" should be included in the response
  551. And User "user2" should be included in the response
  552. And User "user3" should not be included in the response
  553. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
  554. Then the OCS status code should be "100"
  555. And the HTTP status code should be "200"
  556. And User "user0" should not be included in the response
  557. And User "user1" should be included in the response
  558. And User "user2" should not be included in the response
  559. And User "user3" should not be included in the response
  560. # get inherited shares from the a user with no shares rights
  561. And As an "user2"
  562. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
  563. Then the OCS status code should be "404"
  564. And the HTTP status code should be "200"
  565. # get inherited shares from the PoV of a user with resharing rights (user1)
  566. And As an "user1"
  567. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/second/test2.txt"
  568. Then the OCS status code should be "100"
  569. And the HTTP status code should be "200"
  570. And User "user0" should not be included in the response
  571. And User "user1" should not be included in the response
  572. And User "user2" should be included in the response
  573. And User "user3" should not be included in the response
  574. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
  575. Then the OCS status code should be "100"
  576. And the HTTP status code should be "200"
  577. And User "user0" should not be included in the response
  578. And User "user1" should not be included in the response
  579. And User "user2" should not be included in the response
  580. And User "user3" should not be included in the response
  581. # See sharing-v1-part2.feature