1
0

sharing-v1-part4.feature 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. Feature: sharing
  4. Background:
  5. Given using api version "1"
  6. Given using new dav path
  7. # See sharing-v1-part3.feature
  8. Scenario: Creating a new share of a file shows size and mtime
  9. Given user "user0" exists
  10. And user "user1" exists
  11. And As an "user0"
  12. And parameter "shareapi_default_permissions" of app "core" is set to "7"
  13. When creating a share with
  14. | path | welcome.txt |
  15. | shareWith | user1 |
  16. | shareType | 0 |
  17. And the OCS status code should be "100"
  18. And the HTTP status code should be "200"
  19. And Getting info of last share
  20. Then the OCS status code should be "100"
  21. And the HTTP status code should be "200"
  22. And Share fields of last share match with
  23. | item_size | A_NUMBER |
  24. | item_mtime | A_NUMBER |
  25. Scenario: Creating a new share of a file you own shows the file permissions
  26. Given user "user0" exists
  27. And user "user1" exists
  28. And As an "user0"
  29. And parameter "shareapi_default_permissions" of app "core" is set to "7"
  30. When creating a share with
  31. | path | welcome.txt |
  32. | shareWith | user1 |
  33. | shareType | 0 |
  34. And the OCS status code should be "100"
  35. And the HTTP status code should be "200"
  36. And Getting info of last share
  37. Then the OCS status code should be "100"
  38. And the HTTP status code should be "200"
  39. And Share fields of last share match with
  40. | item_permissions | 27 |
  41. Scenario: Receiving a share of a file gives no create permission
  42. Given user "user0" exists
  43. And user "user1" exists
  44. And As an "user0"
  45. And parameter "shareapi_default_permissions" of app "core" is set to "31"
  46. And file "welcome.txt" of user "user0" is shared with user "user1"
  47. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  48. And share 0 is returned with
  49. | path | /welcome.txt |
  50. | permissions | 19 |
  51. | item_permissions | 27 |
  52. When As an "user1"
  53. And user "user1" accepts last share
  54. And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  55. Then the list of returned shares has 1 shares
  56. And share 0 is returned with
  57. | path | /welcome (2).txt |
  58. | permissions | 19 |
  59. | item_permissions | 27 |
  60. Scenario: Receiving a share of a folder gives create permission
  61. Given user "user0" exists
  62. And user "user1" exists
  63. And As an "user0"
  64. And parameter "shareapi_default_permissions" of app "core" is set to "31"
  65. And file "PARENT/CHILD" of user "user0" is shared with user "user1"
  66. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  67. And share 0 is returned with
  68. | path | /PARENT/CHILD |
  69. | permissions | 31 |
  70. | item_permissions | 31 |
  71. When As an "user1"
  72. And user "user1" accepts last share
  73. And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  74. Then the list of returned shares has 1 shares
  75. And share 0 is returned with
  76. | path | /CHILD |
  77. | permissions | 31 |
  78. | item_permissions | 31 |
  79. # User can remove itself from a share
  80. Scenario: Receiving a share of a file without delete permission gives delete permission anyway
  81. Given user "user0" exists
  82. And user "user1" exists
  83. And As an "user0"
  84. And parameter "shareapi_default_permissions" of app "core" is set to "23"
  85. And file "welcome.txt" of user "user0" is shared with user "user1"
  86. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  87. And share 0 is returned with
  88. | path | /welcome.txt |
  89. | permissions | 19 |
  90. | item_permissions | 27 |
  91. When As an "user1"
  92. And user "user1" accepts last share
  93. And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  94. Then the list of returned shares has 1 shares
  95. And share 0 is returned with
  96. | path | /welcome (2).txt |
  97. | permissions | 19 |
  98. | item_permissions | 27 |
  99. Scenario: Receiving a share of a file without delete permission gives delete permission anyway
  100. Given user "user0" exists
  101. And user "user1" exists
  102. And As an "user0"
  103. And group "group1" exists
  104. And user "user1" belongs to group "group1"
  105. And parameter "shareapi_default_permissions" of app "core" is set to "23"
  106. And file "welcome.txt" of user "user0" is shared with group "group1"
  107. And sending "GET" to "/apps/files_sharing/api/v1/shares"
  108. And share 0 is returned with
  109. | path | /welcome.txt |
  110. | permissions | 19 |
  111. | item_permissions | 27 |
  112. When As an "user1"
  113. And user "user1" accepts last share
  114. And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=true"
  115. Then the list of returned shares has 1 shares
  116. And share 0 is returned with
  117. | path | /welcome (2).txt |
  118. | permissions | 19 |
  119. | item_permissions | 27 |