aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration
diff options
context:
space:
mode:
Diffstat (limited to 'build/integration')
-rw-r--r--build/integration/config/behat.yml36
-rw-r--r--build/integration/data/clouds.jpgbin0 -> 538205 bytes
-rw-r--r--build/integration/data/clouds.jpg.license2
-rw-r--r--build/integration/dav_features/dav-v2.feature10
-rw-r--r--build/integration/dav_features/webdav-related.feature10
-rw-r--r--build/integration/features/bootstrap/BasicStructure.php3
-rw-r--r--build/integration/features/bootstrap/ConversionsContext.php59
-rw-r--r--build/integration/features/bootstrap/FederationContext.php45
-rw-r--r--build/integration/federation_features/federated.feature219
-rw-r--r--build/integration/file_conversions/file_conversions.feature122
-rw-r--r--build/integration/files_features/transfer-ownership.feature2
-rwxr-xr-xbuild/integration/run.sh3
12 files changed, 445 insertions, 66 deletions
diff --git a/build/integration/config/behat.yml b/build/integration/config/behat.yml
index 21e0cdb3309..47f8f3c827c 100644
--- a/build/integration/config/behat.yml
+++ b/build/integration/config/behat.yml
@@ -16,7 +16,7 @@ default:
- "%paths.base%/../features"
contexts:
- FeatureContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -39,7 +39,7 @@ default:
- "%paths.base%/../comments_features"
contexts:
- FeatureContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -62,7 +62,7 @@ default:
- "%paths.base%/../dav_features"
contexts:
- DavFeatureContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -85,7 +85,7 @@ default:
- "%paths.base%/../federation_features"
contexts:
- FederationContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -95,7 +95,7 @@ default:
- "%paths.base%/../files_features"
contexts:
- FeatureContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -113,12 +113,22 @@ default:
- CommandLineContext:
baseUrl: http://localhost:8080
ocPath: ../../
+ files_conversion:
+ paths:
+ - "%paths.base%/../file_conversions"
+ contexts:
+ - ConversionsContext:
+ baseUrl: http://localhost:8080
+ admin:
+ - admin
+ - admin
+ regular_user_password: 123456
capabilities:
paths:
- "%paths.base%/../capabilities_features"
contexts:
- CapabilitiesContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -128,7 +138,7 @@ default:
- "%paths.base%/../collaboration_features"
contexts:
- CollaborationContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -138,7 +148,7 @@ default:
- "%paths.base%/../sharees_features"
contexts:
- ShareesContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -148,7 +158,7 @@ default:
- "%paths.base%/../sharing_features"
contexts:
- SharingContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -159,7 +169,7 @@ default:
- "%paths.base%/../videoverification_features"
contexts:
- SharingContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -170,7 +180,7 @@ default:
- "%paths.base%/../setup_features"
contexts:
- SetupContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
@@ -220,10 +230,10 @@ default:
- "%paths.base%/../remoteapi_features"
contexts:
- FeatureContext:
- baseUrl: http://localhost:8080/ocs/
+ baseUrl: http://localhost:8080/ocs/
admin:
- admin
- admin
regular_user_password: 123456
- RemoteContext:
- remote: http://localhost:8080
+ remote: http://localhost:8080
diff --git a/build/integration/data/clouds.jpg b/build/integration/data/clouds.jpg
new file mode 100644
index 00000000000..2433b140766
--- /dev/null
+++ b/build/integration/data/clouds.jpg
Binary files differ
diff --git a/build/integration/data/clouds.jpg.license b/build/integration/data/clouds.jpg.license
new file mode 100644
index 00000000000..d7c54c39d02
--- /dev/null
+++ b/build/integration/data/clouds.jpg.license
@@ -0,0 +1,2 @@
+SPDX-FileCopyrightText: 2019 CHUTTERSNAP <https://unsplash.com/@chuttersnap> <https://unsplash.com/photos/blue-clouds-under-white-sky-9AqIdzEc9pY>"
+SPDX-License-Identifier: LicenseRef-Unsplash
diff --git a/build/integration/dav_features/dav-v2.feature b/build/integration/dav_features/dav-v2.feature
index 02d90242a05..2c74030c462 100644
--- a/build/integration/dav_features/dav-v2.feature
+++ b/build/integration/dav_features/dav-v2.feature
@@ -12,6 +12,16 @@ Feature: dav-v2
When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt"
Then the HTTP status code should be "201"
+ Scenario: Moving and overwriting it's parent
+ Given using new dav path
+ And As an "admin"
+ And user "user0" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And user "user0" created a folder "/test/test"
+ When User "user0" moves file "/test/test" to "/test"
+ Then the HTTP status code should be "403"
+
Scenario: download a file with range using new endpoint
Given using new dav path
And As an "admin"
diff --git a/build/integration/dav_features/webdav-related.feature b/build/integration/dav_features/webdav-related.feature
index fdf633bd580..f97cc8f6f71 100644
--- a/build/integration/dav_features/webdav-related.feature
+++ b/build/integration/dav_features/webdav-related.feature
@@ -38,6 +38,16 @@ Feature: webdav-related
Then the HTTP status code should be "204"
And Downloaded content when downloading file "/textfile0.txt" with range "bytes=0-6" should be "Welcome"
+ Scenario: Moving and overwriting it's parent
+ Given using old dav path
+ And As an "admin"
+ And user "user0" exists
+ And As an "user0"
+ And user "user0" created a folder "/test"
+ And user "user0" created a folder "/test/test"
+ When User "user0" moves file "/test/test" to "/test"
+ Then the HTTP status code should be "403"
+
Scenario: Moving a file to a folder with no permissions
Given using old dav path
And As an "admin"
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php
index b51c0a6a34c..60926e65f5c 100644
--- a/build/integration/features/bootstrap/BasicStructure.php
+++ b/build/integration/features/bootstrap/BasicStructure.php
@@ -8,6 +8,7 @@ use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ClientException;
+use GuzzleHttp\Exception\ServerException;
use PHPUnit\Framework\Assert;
use Psr\Http\Message\ResponseInterface;
@@ -170,6 +171,8 @@ trait BasicStructure {
$this->response = $client->request($verb, $fullUrl, $options);
} catch (ClientException $ex) {
$this->response = $ex->getResponse();
+ } catch (ServerException $ex) {
+ $this->response = $ex->getResponse();
}
}
diff --git a/build/integration/features/bootstrap/ConversionsContext.php b/build/integration/features/bootstrap/ConversionsContext.php
new file mode 100644
index 00000000000..099a2263630
--- /dev/null
+++ b/build/integration/features/bootstrap/ConversionsContext.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+require __DIR__ . '/../../vendor/autoload.php';
+
+use Behat\Behat\Context\Context;
+use Behat\Behat\Context\SnippetAcceptingContext;
+use Behat\Gherkin\Node\TableNode;
+
+class ConversionsContext implements Context, SnippetAcceptingContext {
+ use AppConfiguration;
+ use BasicStructure;
+ use WebDav;
+
+ /** @BeforeScenario */
+ public function setUpScenario() {
+ $this->asAn('admin');
+ $this->setStatusTestingApp(true);
+ }
+
+ /** @AfterScenario */
+ public function tearDownScenario() {
+ $this->asAn('admin');
+ $this->setStatusTestingApp(false);
+ }
+
+ protected function resetAppConfigs() {
+ }
+
+ /**
+ * @When /^user "([^"]*)" converts file "([^"]*)" to "([^"]*)"$/
+ */
+ public function userConvertsTheSavedFileId(string $user, string $path, string $mime) {
+ $this->userConvertsTheSavedFileIdTo($user, $path, $mime, null);
+ }
+
+ /**
+ * @When /^user "([^"]*)" converts file "([^"]*)" to "([^"]*)" and saves it to "([^"]*)"$/
+ */
+ public function userConvertsTheSavedFileIdTo(string $user, string $path, string $mime, ?string $destination) {
+ try {
+ $fileId = $this->getFileIdForPath($user, $path);
+ } catch (Exception $e) {
+ // return a fake value to keep going and be able to test the error
+ $fileId = 0;
+ }
+
+ $data = [['fileId', $fileId], ['targetMimeType', $mime]];
+ if ($destination !== null) {
+ $data[] = ['destination', $destination];
+ }
+
+ $this->asAn($user);
+ $this->sendingToWith('post', '/apps/files/api/v1/convert', new TableNode($data));
+ }
+}
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php
index bbd81396df5..38fb6dd6b39 100644
--- a/build/integration/features/bootstrap/FederationContext.php
+++ b/build/integration/features/bootstrap/FederationContext.php
@@ -7,6 +7,7 @@
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\TableNode;
+use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@@ -168,8 +169,52 @@ class FederationContext implements Context, SnippetAcceptingContext {
self::$phpFederatedServerPid = '';
}
+ /**
+ * @BeforeScenario @TrustedFederation
+ */
+ public function theServersAreTrustingEachOther() {
+ $this->asAn('admin');
+ // Trust the remote server on the local server
+ $this->usingServer('LOCAL');
+ $this->sendRequestForJSON('POST', '/apps/federation/trusted-servers', ['url' => 'http://localhost:' . getenv('PORT')]);
+ Assert::assertTrue(($this->response->getStatusCode() === 200 || $this->response->getStatusCode() === 409));
+
+ // Trust the local server on the remote server
+ $this->usingServer('REMOTE');
+ $this->sendRequestForJSON('POST', '/apps/federation/trusted-servers', ['url' => 'http://localhost:' . getenv('PORT_FED')]);
+ // If the server is already trusted, we expect a 409
+ Assert::assertTrue(($this->response->getStatusCode() === 200 || $this->response->getStatusCode() === 409));
+ }
+
+ /**
+ * @AfterScenario @TrustedFederation
+ */
+ public function theServersAreNoLongerTrustingEachOther() {
+ $this->asAn('admin');
+ // Untrust the remote servers on the local server
+ $this->usingServer('LOCAL');
+ $this->sendRequestForJSON('GET', '/apps/federation/trusted-servers');
+ $this->theHTTPStatusCodeShouldBe('200');
+ $trustedServersIDs = array_map(fn ($server) => $server->id, json_decode($this->response->getBody())->ocs->data);
+ foreach ($trustedServersIDs as $id) {
+ $this->sendRequestForJSON('DELETE', '/apps/federation/trusted-servers/' . $id);
+ $this->theHTTPStatusCodeShouldBe('200');
+ }
+
+ // Untrust the local server on the remote server
+ $this->usingServer('REMOTE');
+ $this->sendRequestForJSON('GET', '/apps/federation/trusted-servers');
+ $this->theHTTPStatusCodeShouldBe('200');
+ $trustedServersIDs = array_map(fn ($server) => $server->id, json_decode($this->response->getBody())->ocs->data);
+ foreach ($trustedServersIDs as $id) {
+ $this->sendRequestForJSON('DELETE', '/apps/federation/trusted-servers/' . $id);
+ $this->theHTTPStatusCodeShouldBe('200');
+ }
+ }
+
protected function resetAppConfigs() {
$this->deleteServerConfig('files_sharing', 'incoming_server2server_group_share_enabled');
$this->deleteServerConfig('files_sharing', 'outgoing_server2server_group_share_enabled');
+ $this->deleteServerConfig('files_sharing', 'federated_trusted_share_auto_accept');
}
}
diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature
index 81a3d3abd02..d3a414cb804 100644
--- a/build/integration/federation_features/federated.feature
+++ b/build/integration/federation_features/federated.feature
@@ -8,7 +8,7 @@ Feature: federated
Scenario: Federate share a file with another server
Given Using server "REMOTE"
And user "user1" exists
- And Using server "LOCAL"
+ Given 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"
@@ -30,6 +30,12 @@ Feature: federated
| displayname_owner | user0 |
| share_with | user1@REMOTE |
| share_with_displayname | user1 |
+ Given Using server "REMOTE"
+ And As an "user1"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 0 shares
+ When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
+ Then the list of returned shares has 1 shares
Scenario: Federated group share a file with another server
Given Using server "REMOTE"
@@ -40,7 +46,7 @@ Feature: federated
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"
+ Given 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"
@@ -64,11 +70,10 @@ Feature: federated
| 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"
+ Given 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"
@@ -94,10 +99,10 @@ Feature: federated
Scenario: Remote sharee can see the pending share
Given Using server "REMOTE"
And user "user1" exists
- And Using server "LOCAL"
+ Given 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"
+ Given 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"
@@ -122,11 +127,11 @@ Feature: federated
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"
+ Given 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"
+ Given 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"
@@ -159,7 +164,7 @@ Feature: federated
Scenario: accept a pending remote share
Given Using server "REMOTE"
And user "user1" exists
- And Using server "LOCAL"
+ Given 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
@@ -175,7 +180,7 @@ Feature: federated
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"
+ Given 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"
@@ -187,45 +192,45 @@ Feature: federated
Given Using server "REMOTE"
And user "user1" exists
And user "user2" exists
- And Using server "LOCAL"
+ Given 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"
+ Given 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 |
+ # 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"
+ Given 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"
+ Given 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"
@@ -236,16 +241,16 @@ Feature: federated
Given Using server "REMOTE"
And user "user1" exists
And user "user2" exists
- And Using server "LOCAL"
+ Given 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"
+ Given 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"
+ 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: List federated share from another server not accepted yet
Given Using server "LOCAL"
@@ -256,7 +261,7 @@ Feature: federated
# 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"
+ Given 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
@@ -270,7 +275,7 @@ Feature: federated
# 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"
+ Given 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"
@@ -296,7 +301,7 @@ Feature: federated
# 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"
+ Given Using server "LOCAL"
And User "user0" from server "LOCAL" accepts last pending share
And remote server is stopped
When As an "user0"
@@ -318,7 +323,7 @@ Feature: federated
# 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"
+ Given 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
@@ -335,8 +340,6 @@ Feature: federated
| user | user0 |
| mountpoint | /remote-share.txt |
-
-
Scenario: Delete federated share with another server
Given Using server "LOCAL"
And user "user0" exists
@@ -349,13 +352,13 @@ Feature: federated
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"
+ Given 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"
+ Given Using server "REMOTE"
When As an "user1"
And Deleting last share
Then the OCS status code should be "100"
@@ -363,7 +366,7 @@ Feature: federated
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"
+ Given 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"
@@ -381,7 +384,7 @@ Feature: federated
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"
+ Given 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"
@@ -394,7 +397,7 @@ Feature: federated
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"
+ Given 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
@@ -408,7 +411,7 @@ Feature: federated
# 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"
+ Given 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"
@@ -435,7 +438,7 @@ Feature: federated
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"
+ Given 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"
@@ -447,7 +450,7 @@ Feature: federated
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"
+ Given 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
@@ -461,7 +464,7 @@ Feature: federated
# 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"
+ Given 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"
@@ -474,3 +477,115 @@ Feature: federated
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: Share to a non-trusted server will NOT auto accept
+ Given Using server "LOCAL"
+ And user "user0" exists
+ Given Using server "REMOTE"
+ And user "userfed2" exists
+ And parameter "federated_trusted_share_auto_accept" of app "files_sharing" is set to "yes"
+ When As an "user0"
+ When User "user0" from server "LOCAL" shares "/textfile0.txt" with user "userfed2" from server "REMOTE"
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=false"
+ And the list of returned shares has 1 shares
+ Given Using server "REMOTE"
+ And using new dav path
+ And As an "userfed2"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 0 shares
+ When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
+ And the list of returned shares has 1 shares
+ And as "userfed2" the file "/textfile0 (2).txt" does not exist
+
+ Scenario: Share to a non-trusted server group will NOT auto accept
+ Given Using server "REMOTE"
+ And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
+ And parameter "federated_trusted_share_auto_accept" of app "files_sharing" is set to "yes"
+ And user "gs-userfed3" exists
+ And user "gs-userfed4" exists
+ And group "groupfed2" exists
+ And As an "admin"
+ And Add user "gs-userfed3" to the group "groupfed2"
+ And Add user "gs-userfed4" to the group "groupfed2"
+ Given Using server "LOCAL"
+ And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
+ And user "gs-user0" exists
+ When As an "gs-user0"
+ When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "groupfed2" from server "REMOTE"
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=false"
+ And the list of returned shares has 1 shares
+ Given Using server "REMOTE"
+ And using new dav path
+ And As an "gs-userfed3"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 0 shares
+ When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
+ And the list of returned shares has 1 shares
+ And as "gs-userfed3" the file "/textfile0 (2).txt" does not exist
+ And As an "gs-userfed4"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 0 shares
+ When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
+ And the list of returned shares has 1 shares
+ And as "gs-userfed4" the file "/textfile0 (2).txt" does not exist
+
+ @TrustedFederation
+ Scenario: Share to a trusted server auto accept
+ Given Using server "LOCAL"
+ And user "user0" exists
+ Given Using server "REMOTE"
+ And user "userfed1" exists
+ And parameter "federated_trusted_share_auto_accept" of app "files_sharing" is set to "yes"
+ When As an "user0"
+ When User "user0" from server "LOCAL" shares "/textfile0.txt" with user "userfed1" from server "REMOTE"
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=false"
+ And the list of returned shares has 1 shares
+ Given Using server "REMOTE"
+ And using new dav path
+ And As an "userfed1"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 1 shares
+ When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
+ And the list of returned shares has 0 shares
+ And as "userfed1" the file "/textfile0 (2).txt" exists
+
+ @TrustedFederation
+ Scenario: Share to a trusted server group auto accept
+ Given Using server "REMOTE"
+ And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
+ And parameter "federated_trusted_share_auto_accept" of app "files_sharing" is set to "yes"
+ And user "gs-userfed1" exists
+ And user "gs-userfed2" exists
+ And group "groupfed1" exists
+ And As an "admin"
+ And Add user "gs-userfed1" to the group "groupfed1"
+ And Add user "gs-userfed2" to the group "groupfed1"
+ Given Using server "LOCAL"
+ And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
+ And user "gs-user0" exists
+ When As an "gs-user0"
+ When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "groupfed1" from server "REMOTE"
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares?shared_with_me=false"
+ And the list of returned shares has 1 shares
+ Given Using server "REMOTE"
+ And using new dav path
+ And As an "gs-userfed1"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 1 shares
+ When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
+ And the list of returned shares has 0 shares
+ And as "gs-userfed1" the file "/textfile0 (2).txt" exists
+ And As an "gs-userfed2"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 1 shares
+ When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
+ And the list of returned shares has 0 shares
+ And as "gs-userfed2" the file "/textfile0 (2).txt" exists
diff --git a/build/integration/file_conversions/file_conversions.feature b/build/integration/file_conversions/file_conversions.feature
new file mode 100644
index 00000000000..92dc11a647a
--- /dev/null
+++ b/build/integration/file_conversions/file_conversions.feature
@@ -0,0 +1,122 @@
+# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+Feature: conversions
+ Background:
+ Given using api version "2"
+ Given using new dav path
+ Given user "user0" exists
+
+ Scenario: Converting a file works
+ Given user "user0" uploads file "data/clouds.jpg" to "/image.jpg"
+ Then as "user0" the file "/image.jpg" exists
+ When user "user0" converts file "/image.jpg" to "image/png"
+ Then the HTTP status code should be "201"
+ Then the OCS status code should be "201"
+ Then as "user0" the file "/image.png" exists
+
+ Scenario: Converting a file to a given path works
+ Given user "user0" uploads file "data/clouds.jpg" to "/image.jpg"
+ And User "user0" created a folder "/folder"
+ Then as "user0" the file "/image.jpg" exists
+ Then as "user0" the folder "/folder" exists
+ When user "user0" converts file "/image.jpg" to "image/png" and saves it to "/folder/image.png"
+ Then the HTTP status code should be "201"
+ Then the OCS status code should be "201"
+ Then as "user0" the file "/folder/image.png" exists
+ Then as "user0" the file "/image.png" does not exist
+
+ Scenario: Converting a file path with overwrite
+ Given user "user0" uploads file "data/clouds.jpg" to "/image.jpg"
+ And user "user0" uploads file "data/green-square-256.png" to "/image.png"
+ Then as "user0" the file "/image.jpg" exists
+ Then as "user0" the file "/image.png" exists
+ When user "user0" converts file "/image.jpg" to "image/png"
+ Then the HTTP status code should be "201"
+ Then the OCS status code should be "201"
+ Then as "user0" the file "/image.jpg" exists
+ Then as "user0" the file "/image.png" exists
+ Then as "user0" the file "/image (2).png" exists
+
+ Scenario: Converting a file path with overwrite to a given path
+ Given user "user0" uploads file "data/clouds.jpg" to "/image.jpg"
+ And User "user0" created a folder "/folder"
+ And user "user0" uploads file "data/green-square-256.png" to "/folder/image.png"
+ Then as "user0" the file "/image.jpg" exists
+ Then as "user0" the folder "/folder" exists
+ Then as "user0" the file "/folder/image.png" exists
+ When user "user0" converts file "/image.jpg" to "image/png" and saves it to "/folder/image.png"
+ Then the HTTP status code should be "201"
+ Then the OCS status code should be "201"
+ Then as "user0" the file "/folder/image.png" exists
+ Then as "user0" the file "/folder/image (2).png" exists
+ Then as "user0" the file "/image.png" does not exist
+ Then as "user0" the file "/image.jpg" exists
+
+ Scenario: Converting a file which does not exist fails
+ When user "user0" converts file "/image.jpg" to "image/png"
+ Then the HTTP status code should be "404"
+ Then the OCS status code should be "404"
+ Then as "user0" the file "/image.jpg" does not exist
+ Then as "user0" the file "/image.png" does not exist
+
+ Scenario: Converting a file to an invalid destination path fails
+ Given user "user0" uploads file "data/clouds.jpg" to "/image.jpg"
+ When user "user0" converts file "/image.jpg" to "image/png" and saves it to "/folder/image.png"
+ Then the HTTP status code should be "404"
+ Then the OCS status code should be "404"
+ Then as "user0" the file "/image.jpg" exists
+ Then as "user0" the file "/folder/image.png" does not exist
+
+ Scenario: Converting a file to an invalid format fails
+ Given user "user0" uploads file "data/clouds.jpg" to "/image.jpg"
+ When user "user0" converts file "/image.jpg" to "image/invalid"
+ Then the HTTP status code should be "500"
+ Then the OCS status code should be "999"
+ Then as "user0" the file "/image.jpg" exists
+ Then as "user0" the file "/image.png" does not exist
+
+Scenario: Converting a file to a given path without extension fails
+ Given user "user0" uploads file "data/clouds.jpg" to "/image.jpg"
+ And User "user0" created a folder "/folder"
+ Then as "user0" the file "/image.jpg" exists
+ Then as "user0" the folder "/folder" exists
+ When user "user0" converts file "/image.jpg" to "image/png" and saves it to "/folder/image"
+ Then the HTTP status code should be "400"
+ Then the OCS status code should be "400"
+ Then as "user0" the file "/folder/image.png" does not exist
+ Then as "user0" the file "/image.png" does not exist
+
+ @local_storage
+ Scenario: Converting a file bigger than 100 MiB fails
+ Given file "/image.jpg" of size 108003328 is created in local storage
+ Then as "user0" the folder "/local_storage" exists
+ Then as "user0" the file "/local_storage/image.jpg" exists
+ When user "user0" converts file "/local_storage/image.jpg" to "image/png" and saves it to "/image.png"
+ Then the HTTP status code should be "400"
+ Then the OCS status code should be "400"
+ Then as "user0" the file "/image.png" does not exist
+
+ Scenario: Forbid conversion to a destination without create permission
+ Given user "user1" exists
+ # Share the folder with user1
+ Given User "user0" created a folder "/folder"
+ Then As an "user0"
+ When creating a share with
+ | path | folder |
+ | shareWith | user1 |
+ | shareType | 0 |
+ | permissions | 1 |
+ Then the OCS status code should be "200"
+ And the HTTP status code should be "200"
+ # Create the folder, upload the image
+ Then As an "user1"
+ Given user "user1" accepts last share
+ Given as "user1" the folder "/folder" exists
+ Given user "user1" uploads file "data/clouds.jpg" to "/image.jpg"
+ Then as "user1" the file "/image.jpg" exists
+ # Try to convert the image to a folder where user1 has no create permission
+ When user "user1" converts file "/image.jpg" to "image/png" and saves it to "/folder/folder.png"
+ Then the OCS status code should be "403"
+ And the HTTP status code should be "403"
+ Then as "user1" the file "/folder/folder.png" does not exist
diff --git a/build/integration/files_features/transfer-ownership.feature b/build/integration/files_features/transfer-ownership.feature
index 34fed8b9efd..4e5407cadbb 100644
--- a/build/integration/files_features/transfer-ownership.feature
+++ b/build/integration/files_features/transfer-ownership.feature
@@ -514,7 +514,7 @@ Feature: transfer-ownership
And user "user2" accepts last share
When transferring ownership of path "test" from "user0" to "user1"
Then the command failed with exit code 1
- And the command output contains the text "Could not transfer files."
+ And the command error output contains the text "Moving a storage (user0/files/test) into another storage (user1) is not allowed"
Scenario: transferring ownership does not transfer received shares
Given user "user0" exists
diff --git a/build/integration/run.sh b/build/integration/run.sh
index 309f8ed0c75..8efb7593dfe 100755
--- a/build/integration/run.sh
+++ b/build/integration/run.sh
@@ -22,6 +22,8 @@ if [ "$INSTALLED" == "true" ]; then
$OCC config:system:set auth.bruteforce.protection.enabled --value false --type bool
# Allow local remote urls otherwise we can not share
$OCC config:system:set allow_local_remote_servers --value true --type bool
+ # Allow self signed certificates
+ $OCC config:system:set sharing.federation.allowSelfSignedCertificates --value true --type bool
else
if [ "$SCENARIO_TO_RUN" != "setup_features/setup.feature" ]; then
echo "Nextcloud instance needs to be installed" >&2
@@ -38,6 +40,7 @@ if [ -z "$EXECUTOR_NUMBER" ]; then
fi
PORT=$((8080 + $EXECUTOR_NUMBER))
echo $PORT
+export PORT
echo "" > "${NC_DATADIR}/nextcloud.log"
echo "" > phpserver.log