123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510 |
- # SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
- # SPDX-FileCopyrightText: 2015-2016 ownCloud, Inc.
- # SPDX-License-Identifier: AGPL-3.0-only
- Feature: federated
- Background:
- Given using api version "1"
- Scenario: Federate share a file with another server
- Given Using server "REMOTE"
- And user "user1" exists
- And Using server "LOCAL"
- And user "user0" exists
- When User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And Share fields of last share match with
- | id | A_NUMBER |
- | item_type | file |
- | item_source | A_NUMBER |
- | share_type | 6 |
- | file_source | A_NUMBER |
- | path | /textfile0.txt |
- | permissions | 19 |
- | stime | A_NUMBER |
- | storage | A_NUMBER |
- | mail_send | 0 |
- | uid_owner | user0 |
- | storage_id | home::user0 |
- | file_parent | A_NUMBER |
- | displayname_owner | user0 |
- | share_with | user1@REMOTE |
- | share_with_displayname | user1 |
- Scenario: Federated group share a file with another server
- Given Using server "REMOTE"
- And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
- And user "gs-user1" exists
- And user "gs-user2" exists
- And group "group1" exists
- And As an "admin"
- And Add user "gs-user1" to the group "group1"
- And Add user "gs-user2" to the group "group1"
- And Using server "LOCAL"
- And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
- And user "gs-user0" exists
- When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And Share fields of last share match with
- | id | A_NUMBER |
- | item_type | file |
- | item_source | A_NUMBER |
- | share_type | 9 |
- | file_source | A_NUMBER |
- | path | /textfile0.txt |
- | permissions | 19 |
- | stime | A_NUMBER |
- | storage | A_NUMBER |
- | mail_send | 0 |
- | uid_owner | gs-user0 |
- | storage_id | home::gs-user0 |
- | file_parent | A_NUMBER |
- | displayname_owner | gs-user0 |
- | share_with | group1@REMOTE |
- | share_with_displayname | group1@REMOTE |
- Scenario: Federate share a file with local server
- Given Using server "LOCAL"
- And user "user0" exists
- And Using server "REMOTE"
- And user "user1" exists
- When User "user1" from server "REMOTE" shares "/textfile0.txt" with user "user0" from server "LOCAL"
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And Share fields of last share match with
- | id | A_NUMBER |
- | item_type | file |
- | item_source | A_NUMBER |
- | share_type | 6 |
- | file_source | A_NUMBER |
- | path | /textfile0.txt |
- | permissions | 19 |
- | stime | A_NUMBER |
- | storage | A_NUMBER |
- | mail_send | 0 |
- | uid_owner | user1 |
- | storage_id | home::user1 |
- | file_parent | A_NUMBER |
- | displayname_owner | user1 |
- | share_with | user0@LOCAL |
- | share_with_displayname | user0 |
- Scenario: Remote sharee can see the pending share
- Given Using server "REMOTE"
- And user "user1" exists
- And Using server "LOCAL"
- And user "user0" exists
- And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
- And Using server "REMOTE"
- And As an "user1"
- When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And Share fields of last share match with
- | id | A_NUMBER |
- | remote | LOCAL |
- | remote_id | A_NUMBER |
- | share_token | A_TOKEN |
- | name | /textfile0.txt |
- | owner | user0 |
- | user | user1 |
- | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
- | accepted | 0 |
- Scenario: Remote sharee can see the pending group share
- Given Using server "REMOTE"
- And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
- And user "gs-user1" exists
- And user "gs-user2" exists
- And group "group1" exists
- And As an "admin"
- And Add user "gs-user1" to the group "group1"
- And Add user "gs-user2" to the group "group1"
- And Using server "LOCAL"
- And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
- And user "gs-user0" exists
- When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
- And Using server "REMOTE"
- And As an "gs-user1"
- When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And Share fields of last share match with
- | id | A_NUMBER |
- | remote | LOCAL |
- | remote_id | A_NUMBER |
- | share_token | A_TOKEN |
- | name | /textfile0.txt |
- | owner | gs-user0 |
- | user | group1 |
- | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
- | accepted | 0 |
- And As an "gs-user2"
- When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And Share fields of last share match with
- | id | A_NUMBER |
- | remote | LOCAL |
- | remote_id | A_NUMBER |
- | share_token | A_TOKEN |
- | name | /textfile0.txt |
- | owner | gs-user0 |
- | user | group1 |
- | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
- | accepted | 0 |
- Scenario: accept a pending remote share
- Given Using server "REMOTE"
- And user "user1" exists
- And Using server "LOCAL"
- And user "user0" exists
- And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
- When User "user1" from server "REMOTE" accepts last pending share
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- Scenario: accept a pending remote group share
- Given Using server "REMOTE"
- And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
- And user "gs-user1" exists
- And user "gs-user2" exists
- And group "group1" exists
- And As an "admin"
- And Add user "gs-user1" to the group "group1"
- And Add user "gs-user2" to the group "group1"
- And Using server "LOCAL"
- And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
- And user "gs-user0" exists
- When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
- When User "gs-user1" from server "REMOTE" accepts last pending share
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- Scenario: Reshare a federated shared file
- Given Using server "REMOTE"
- And user "user1" exists
- And user "user2" exists
- And Using server "LOCAL"
- And user "user0" exists
- And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
- And User "user1" from server "REMOTE" accepts last pending share
- And Using server "REMOTE"
- And As an "user1"
- When creating a share with
- | path | /textfile0 (2).txt |
- | shareType | 0 |
- | shareWith | user2 |
- | permissions | 19 |
- #Then the OCS status code should be "100"
- #And the HTTP status code should be "200"
- #And Share fields of last share match with
- # | id | A_NUMBER |
- # | item_type | file |
- # | item_source | A_NUMBER |
- # | share_type | 0 |
- # | file_source | A_NUMBER |
- # | path | /textfile0 (2).txt |
- # | permissions | 19 |
- # | stime | A_NUMBER |
- # | storage | A_NUMBER |
- # | mail_send | 1 |
- # | uid_owner | user1 |
- # | file_parent | A_NUMBER |
- # | displayname_owner | user1 |
- # | share_with | user2 |
- # | share_with_displayname | user2 |
- Scenario: Overwrite a federated shared file as recipient
- Given Using server "REMOTE"
- And user "user1" exists
- And user "user2" exists
- And Using server "LOCAL"
- And user "user0" exists
- And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
- And User "user1" from server "REMOTE" accepts last pending share
- And Using server "REMOTE"
- And As an "user1"
- And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA"
- When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/textfile0 (2).txt"
- And Downloading file "/textfile0 (2).txt" with range "bytes=0-8"
- Then Downloaded content should be "BLABLABLA"
- Scenario: Overwrite a federated shared folder as recipient
- Given Using server "REMOTE"
- And user "user1" exists
- And user "user2" exists
- And Using server "LOCAL"
- And user "user0" exists
- And User "user0" from server "LOCAL" shares "/PARENT" with user "user1" from server "REMOTE"
- And User "user1" from server "REMOTE" accepts last pending share
- And Using server "REMOTE"
- And As an "user1"
- And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA"
- #When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/PARENT (2)/textfile0.txt"
- #And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8"
- #Then Downloaded content should be "BLABLABLA"
- Scenario: Overwrite a federated shared file as recipient using old chunking
- Given Using server "REMOTE"
- And user "user1" exists
- And user "user2" exists
- And Using server "LOCAL"
- And user "user0" exists
- And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
- And User "user1" from server "REMOTE" accepts last pending share
- And Using server "REMOTE"
- And As an "user1"
- #And user "user1" uploads chunk file "1" of "3" with "AAAAA" to "/textfile0 (2).txt"
- #And user "user1" uploads chunk file "2" of "3" with "BBBBB" to "/textfile0 (2).txt"
- #And user "user1" uploads chunk file "3" of "3" with "CCCCC" to "/textfile0 (2).txt"
- #When Downloading file "/textfile0 (2).txt" with range "bytes=0-4"
- #Then Downloaded content should be "AAAAA"
- Scenario: Overwrite a federated shared folder as recipient using old chunking
- Given Using server "REMOTE"
- And user "user1" exists
- And user "user2" exists
- And Using server "LOCAL"
- And user "user0" exists
- And User "user0" from server "LOCAL" shares "/PARENT" with user "user1" from server "REMOTE"
- And User "user1" from server "REMOTE" accepts last pending share
- And Using server "REMOTE"
- And As an "user1"
- #And user "user1" uploads chunk file "1" of "3" with "AAAAA" to "/PARENT (2)/textfile0.txt"
- #And user "user1" uploads chunk file "2" of "3" with "BBBBB" to "/PARENT (2)/textfile0.txt"
- #And user "user1" uploads chunk file "3" of "3" with "CCCCC" to "/PARENT (2)/textfile0.txt"
- #When Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=3-13"
- #Then Downloaded content should be "AABBBBBCCCC"
- Scenario: List federated share from another server not accepted yet
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And Using server "LOCAL"
- When As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- Then the list of returned shares has 0 shares
- Scenario: List federated share from another server
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- When As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- Then the list of returned shares has 1 shares
- And remote share 0 is returned with
- | remote | http://localhost:8180/ |
- | name | /remote-share.txt |
- | owner | user1 |
- | user | user0 |
- | mountpoint | /remote-share.txt |
- | mimetype | text/plain |
- | mtime | A_NUMBER |
- | permissions | 27 |
- | type | file |
- | file_id | A_NUMBER |
- Scenario: List federated share from another server no longer reachable
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- And remote server is stopped
- When As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- Then the list of returned shares has 1 shares
- And remote share 0 is returned with
- | remote | http://localhost:8180/ |
- | name | /remote-share.txt |
- | owner | user1 |
- | user | user0 |
- | mountpoint | /remote-share.txt |
- Scenario: List federated share from another server no longer reachable after caching the file entry
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- # Checking that the file exists caches the file entry, which causes an
- # exception to be thrown when getting the file info if the remote server is
- # unreachable.
- And as "user0" the file "/remote-share.txt" exists
- And remote server is stopped
- When As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- Then the list of returned shares has 1 shares
- And remote share 0 is returned with
- | remote | http://localhost:8180/ |
- | name | /remote-share.txt |
- | owner | user1 |
- | user | user0 |
- | mountpoint | /remote-share.txt |
- Scenario: Delete federated share with another server
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And As an "user1"
- And sending "GET" to "/apps/files_sharing/api/v1/shares"
- And the list of returned shares has 1 shares
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- And as "user0" the file "/remote-share.txt" exists
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 1 shares
- And Using server "REMOTE"
- When As an "user1"
- And Deleting last share
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And As an "user1"
- And sending "GET" to "/apps/files_sharing/api/v1/shares"
- And the list of returned shares has 0 shares
- And Using server "LOCAL"
- And as "user0" the file "/remote-share.txt" does not exist
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 0 shares
- Scenario: Delete federated share from another server
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And As an "user1"
- And sending "GET" to "/apps/files_sharing/api/v1/shares"
- And the list of returned shares has 1 shares
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- And as "user0" the file "/remote-share.txt" exists
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 1 shares
- When user "user0" deletes last accepted remote share
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And as "user0" the file "/remote-share.txt" does not exist
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 0 shares
- And Using server "REMOTE"
- And As an "user1"
- And sending "GET" to "/apps/files_sharing/api/v1/shares"
- And the list of returned shares has 0 shares
- Scenario: Delete federated share from another server no longer reachable
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- And as "user0" the file "/remote-share.txt" exists
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 1 shares
- And remote server is stopped
- When user "user0" deletes last accepted remote share
- Then the OCS status code should be "100"
- And the HTTP status code should be "200"
- And as "user0" the file "/remote-share.txt" does not exist
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 0 shares
- Scenario: Delete federated share file from another server
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And As an "user1"
- And sending "GET" to "/apps/files_sharing/api/v1/shares"
- And the list of returned shares has 1 shares
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- And as "user0" the file "/remote-share.txt" exists
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 1 shares
- When User "user0" deletes file "/remote-share.txt"
- Then the HTTP status code should be "204"
- And as "user0" the file "/remote-share.txt" does not exist
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 0 shares
- And Using server "REMOTE"
- And As an "user1"
- And sending "GET" to "/apps/files_sharing/api/v1/shares"
- And the list of returned shares has 0 shares
- Scenario: Delete federated share file from another server no longer reachable
- Given Using server "LOCAL"
- And user "user0" exists
- Given Using server "REMOTE"
- And user "user1" exists
- # Rename file so it has a unique name in the target server (as the target
- # server may have its own /textfile0.txt" file)
- And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
- And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
- And Using server "LOCAL"
- And User "user0" from server "LOCAL" accepts last pending share
- And as "user0" the file "/remote-share.txt" exists
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 1 shares
- And remote server is stopped
- When User "user0" deletes file "/remote-share.txt"
- Then the HTTP status code should be "204"
- And as "user0" the file "/remote-share.txt" does not exist
- And As an "user0"
- And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
- And the list of returned shares has 0 shares
|