sharing-v1.feature 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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 "401"
  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 "enforcePasswordProtection" of app "sharebymail" 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. And the OCS status code should be "100"
  256. And the HTTP status code should be "200"
  257. And Getting info of last share
  258. Then the OCS status code should be "100"
  259. And the HTTP status code should be "200"
  260. And Share fields of last share match with
  261. | id | A_NUMBER |
  262. | item_type | folder |
  263. | item_source | A_NUMBER |
  264. | share_type | 3 |
  265. | file_source | A_NUMBER |
  266. | file_target | /FOLDER |
  267. | permissions | 31 |
  268. | stime | A_NUMBER |
  269. | token | A_TOKEN |
  270. | storage | A_NUMBER |
  271. | mail_send | 0 |
  272. | uid_owner | user0 |
  273. | storage_id | home::user0 |
  274. | file_parent | A_NUMBER |
  275. | displayname_owner | user0 |
  276. | url | AN_URL |
  277. | mimetype | httpd/unix-directory |
  278. Scenario: Creating a new public share, updating its permissions for "hide file list"
  279. Given user "user0" exists
  280. And As an "user0"
  281. When creating a share with
  282. | path | FOLDER |
  283. | shareType | 3 |
  284. And Updating last share with
  285. | permissions | 4 |
  286. And the OCS status code should be "100"
  287. And the HTTP status code should be "200"
  288. And Getting info of last share
  289. Then the OCS status code should be "100"
  290. And the HTTP status code should be "200"
  291. And Share fields of last share match with
  292. | id | A_NUMBER |
  293. | item_type | folder |
  294. | item_source | A_NUMBER |
  295. | share_type | 3 |
  296. | file_source | A_NUMBER |
  297. | file_target | /FOLDER |
  298. | permissions | 4 |
  299. | stime | A_NUMBER |
  300. | token | A_TOKEN |
  301. | storage | A_NUMBER |
  302. | mail_send | 0 |
  303. | uid_owner | user0 |
  304. | storage_id | home::user0 |
  305. | file_parent | A_NUMBER |
  306. | displayname_owner | user0 |
  307. | url | AN_URL |
  308. | mimetype | httpd/unix-directory |
  309. Scenario: Creating a new public share, updating publicUpload option and getting its info
  310. Given user "user0" exists
  311. And As an "user0"
  312. When creating a share with
  313. | path | FOLDER |
  314. | shareType | 3 |
  315. And Updating last share with
  316. | publicUpload | true |
  317. And the OCS status code should be "100"
  318. And the HTTP status code should be "200"
  319. And Getting info of last share
  320. Then the OCS status code should be "100"
  321. And the HTTP status code should be "200"
  322. And Share fields of last share match with
  323. | id | A_NUMBER |
  324. | item_type | folder |
  325. | item_source | A_NUMBER |
  326. | share_type | 3 |
  327. | file_source | A_NUMBER |
  328. | file_target | /FOLDER |
  329. | permissions | 31 |
  330. | stime | A_NUMBER |
  331. | token | A_TOKEN |
  332. | storage | A_NUMBER |
  333. | mail_send | 0 |
  334. | uid_owner | user0 |
  335. | storage_id | home::user0 |
  336. | file_parent | A_NUMBER |
  337. | displayname_owner | user0 |
  338. | url | AN_URL |
  339. | mimetype | httpd/unix-directory |
  340. Scenario: Creating a new share of a file with default permissions
  341. Given user "user0" exists
  342. And user "user1" exists
  343. And As an "user0"
  344. And parameter "shareapi_default_permissions" of app "core" is set to "7"
  345. When creating a share with
  346. | path | welcome.txt |
  347. | shareWith | user1 |
  348. | shareType | 0 |
  349. And the OCS status code should be "100"
  350. And the HTTP status code should be "200"
  351. And Getting info of last share
  352. Then the OCS status code should be "100"
  353. And the HTTP status code should be "200"
  354. And Share fields of last share match with
  355. | permissions | 3 |
  356. Scenario: Creating a new share of a folder with default permissions
  357. Given user "user0" exists
  358. And user "user1" exists
  359. And As an "user0"
  360. And parameter "shareapi_default_permissions" of app "core" is set to "7"
  361. When creating a share with
  362. | path | FOLDER |
  363. | shareWith | user1 |
  364. | shareType | 0 |
  365. And the OCS status code should be "100"
  366. And the HTTP status code should be "200"
  367. And Getting info of last share
  368. Then the OCS status code should be "100"
  369. And the HTTP status code should be "200"
  370. And Share fields of last share match with
  371. | permissions | 7 |
  372. Scenario: Creating a new internal share with default expiration date
  373. Given user "user0" exists
  374. And user "user1" exists
  375. And As an "user0"
  376. And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
  377. And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
  378. When creating a share with
  379. | path | welcome.txt |
  380. | shareWith | user1 |
  381. | shareType | 0 |
  382. And the OCS status code should be "100"
  383. And the HTTP status code should be "200"
  384. And Getting info of last share
  385. Then the OCS status code should be "100"
  386. And the HTTP status code should be "200"
  387. And Share fields of last share match with
  388. | expiration | +3 days |
  389. Scenario: Creating a new internal share with relaxed default expiration date
  390. Given user "user0" exists
  391. And user "user1" exists
  392. And As an "user0"
  393. And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
  394. And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
  395. And parameter "internal_defaultExpDays" of app "core" is set to "1"
  396. When creating a share with
  397. | path | welcome.txt |
  398. | shareWith | user1 |
  399. | shareType | 0 |
  400. And the OCS status code should be "100"
  401. And the HTTP status code should be "200"
  402. And Getting info of last share
  403. Then the OCS status code should be "100"
  404. And the HTTP status code should be "200"
  405. And Share fields of last share match with
  406. | expiration | +1 days |
  407. Scenario: Creating a new internal share with relaxed default expiration date too large
  408. Given user "user0" exists
  409. And user "user1" exists
  410. And As an "user0"
  411. And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
  412. And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
  413. And parameter "internal_defaultExpDays" of app "core" is set to "10"
  414. When creating a share with
  415. | path | welcome.txt |
  416. | shareWith | user1 |
  417. | shareType | 0 |
  418. And the OCS status code should be "100"
  419. And the HTTP status code should be "200"
  420. And Getting info of last share
  421. Then the OCS status code should be "100"
  422. And the HTTP status code should be "200"
  423. And Share fields of last share match with
  424. | expiration | +3 days |
  425. Scenario: Creating a new link share with default expiration date
  426. Given user "user0" exists
  427. And As an "user0"
  428. And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
  429. And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
  430. When creating a share with
  431. | path | welcome.txt |
  432. | shareType | 3 |
  433. And the OCS status code should be "100"
  434. And the HTTP status code should be "200"
  435. And Getting info of last share
  436. Then the OCS status code should be "100"
  437. And the HTTP status code should be "200"
  438. And Share fields of last share match with
  439. | expiration | +3 days |
  440. Scenario: Creating a new link share with relaxed default expiration date
  441. Given user "user0" exists
  442. And As an "user0"
  443. And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
  444. And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
  445. And parameter "link_defaultExpDays" of app "core" is set to "1"
  446. When creating a share with
  447. | path | welcome.txt |
  448. | shareType | 3 |
  449. And the OCS status code should be "100"
  450. And the HTTP status code should be "200"
  451. And Getting info of last share
  452. Then the OCS status code should be "100"
  453. And the HTTP status code should be "200"
  454. And Share fields of last share match with
  455. | expiration | +1 days |
  456. Scenario: Creating a new link share with relaxed default expiration date too large
  457. Given user "user0" exists
  458. And As an "user0"
  459. And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
  460. And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
  461. And parameter "link_defaultExpDays" of app "core" is set to "10"
  462. When creating a share with
  463. | path | welcome.txt |
  464. | shareType | 3 |
  465. And the OCS status code should be "100"
  466. And the HTTP status code should be "200"
  467. And Getting info of last share
  468. Then the OCS status code should be "100"
  469. And the HTTP status code should be "200"
  470. And Share fields of last share match with
  471. | expiration | +3 days |
  472. Scenario: getting all shares of a user using that user
  473. Given user "user0" exists
  474. And user "user1" exists
  475. And file "textfile0.txt" of user "user0" is shared with user "user1"
  476. And As an "user0"
  477. When sending "GET" to "/apps/files_sharing/api/v1/shares"
  478. Then the OCS status code should be "100"
  479. And the HTTP status code should be "200"
  480. And File "textfile0.txt" should be included in the response
  481. Scenario: getting all shares of a user using another user
  482. Given user "user0" exists
  483. And user "user1" exists
  484. And file "textfile0.txt" of user "user0" is shared with user "user1"
  485. And As an "admin"
  486. When sending "GET" to "/apps/files_sharing/api/v1/shares"
  487. Then the OCS status code should be "100"
  488. And the HTTP status code should be "200"
  489. And File "textfile0.txt" should not be included in the response
  490. Scenario: getting all shares of a file
  491. Given user "user0" exists
  492. And user "user1" exists
  493. And user "user2" exists
  494. And user "user3" exists
  495. And file "textfile0.txt" of user "user0" is shared with user "user1"
  496. And file "textfile0.txt" of user "user0" is shared with user "user2"
  497. And As an "user0"
  498. When sending "GET" to "/apps/files_sharing/api/v1/shares?path=textfile0.txt"
  499. Then the OCS status code should be "100"
  500. And the HTTP status code should be "200"
  501. And User "user1" should be included in the response
  502. And User "user2" should be included in the response
  503. And User "user3" should not be included in the response
  504. Scenario: getting all shares of a file with a user with resharing rights but not yourself
  505. Given user "user0" exists
  506. And user "user1" exists
  507. And user "user2" exists
  508. And user "user3" exists
  509. And file "textfile0.txt" of user "user0" is shared with user "user1"
  510. And user "user1" accepts last share
  511. And file "textfile0.txt" of user "user0" is shared with user "user2"
  512. And As an "user1"
  513. When sending "GET" to "/apps/files_sharing/api/v1/shares?path=textfile0 (2).txt&reshares=true"
  514. Then the OCS status code should be "100"
  515. And the HTTP status code should be "200"
  516. And User "user1" should not be included in the response
  517. And User "user2" should be included in the response
  518. And User "user3" should not be included in the response
  519. Scenario: getting inherited shares of a file
  520. Given user "user0" exists
  521. And user "user1" exists
  522. And user "user2" exists
  523. And user "user3" exists
  524. # will be shared with user1
  525. And User "user0" created a folder "/first"
  526. # will be shared with user1, user2
  527. And User "user0" created a folder "/first/second"
  528. # will be shared with user1, user3
  529. And User "user0" uploads file "data/textfile.txt" to "/first/test1.txt"
  530. # will be shared with user1, user2, user3
  531. And User "user0" uploads file "data/textfile.txt" to "/first/second/test2.txt"
  532. And As an "user0"
  533. And creating a share with
  534. | path | /first |
  535. | shareType | 0 |
  536. | shareWith | user1 |
  537. | permissions | 16 |
  538. And As an "user1"
  539. And accepting last share
  540. And folder "first/second" of user "user0" is shared with user "user2"
  541. And file "first/test1.txt" of user "user0" is shared with user "user3"
  542. And file "first/second/test2.txt" of user "user0" is shared with user "user3"
  543. # get inherited shares from the owner PoV
  544. And As an "user0"
  545. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/second/test2.txt"
  546. Then the OCS status code should be "100"
  547. And the HTTP status code should be "200"
  548. And User "user0" should not be included in the response
  549. And User "user1" should be included in the response
  550. And User "user2" should be included in the response
  551. And User "user3" should not be included in the response
  552. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
  553. Then the OCS status code should be "100"
  554. And the HTTP status code should be "200"
  555. And User "user0" should not be included in the response
  556. And User "user1" should be included in the response
  557. And User "user2" should not be included in the response
  558. And User "user3" should not be included in the response
  559. # get inherited shares from the a user with no shares rights
  560. And As an "user2"
  561. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
  562. Then the OCS status code should be "404"
  563. And the HTTP status code should be "200"
  564. # get inherited shares from the PoV of a user with resharing rights (user1)
  565. And As an "user1"
  566. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/second/test2.txt"
  567. Then the OCS status code should be "100"
  568. And the HTTP status code should be "200"
  569. And User "user0" should not be included in the response
  570. And User "user1" should not be included in the response
  571. And User "user2" should be included in the response
  572. And User "user3" should not be included in the response
  573. When sending "GET" to "/apps/files_sharing/api/v1/shares/inherited?path=first/test1.txt"
  574. Then the OCS status code should be "100"
  575. And the HTTP status code should be "200"
  576. And User "user0" should not be included in the response
  577. And User "user1" should not be included in the response
  578. And User "user2" should not be included in the response
  579. And User "user3" should not be included in the response
  580. # See sharing-v1-part2.feature