Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-07-06 18:54:18 +0300
committerVincent Petry <pvince81@owncloud.com>2016-07-12 09:56:13 +0300
commit121a3304a0c37ccda0e1b63ddc528cba9121a36e (patch)
tree1c42dda89f2355c13b63dc61d78d076c0094196b /build
parent3a450f8f15f5707801d3888b6514fd2fc40905fa (diff)
Additional perm check in Webdav
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/WebDav.php28
-rw-r--r--build/integration/features/webdav-related.feature111
2 files changed, 135 insertions, 4 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index 0a4624ccc2b..f7861399d76 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -61,7 +61,27 @@ trait WebDav {
public function userMovesFile($user, $fileSource, $fileDestination){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
$headers['Destination'] = $fullUrl . $fileDestination;
- $this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
+ try {
+ $this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ $this->response = $e->getResponse();
+ }
+ }
+
+ /**
+ * @When /^User "([^"]*)" copies file "([^"]*)" to "([^"]*)"$/
+ * @param string $user
+ * @param string $fileSource
+ * @param string $fileDestination
+ */
+ public function userCopiesFile($user, $fileSource, $fileDestination){
+ $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
+ $headers['Destination'] = $fullUrl . $fileDestination;
+ try {
+ $this->response = $this->makeDavRequest($user, "COPY", $fileSource, $headers);
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ $this->response = $e->getResponse();
+ }
}
/**
@@ -110,7 +130,11 @@ trait WebDav {
* @When Downloading file :fileName
*/
public function downloadingFile($fileName) {
- $this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileName, []);
+ try {
+ $this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileName, []);
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ $this->response = $e->getResponse();
+ }
}
/**
diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature
index 45a36499251..eb4bb3aa7bb 100644
--- a/build/integration/features/webdav-related.feature
+++ b/build/integration/features/webdav-related.feature
@@ -2,12 +2,119 @@ Feature: webdav-related
Background:
Given using api version "1"
- Scenario: moving a file old way
+ Scenario: Moving a file
Given using dav path "remote.php/webdav"
And As an "admin"
And user "user0" exists
- When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt"
+ And As an "user0"
+ When User "user0" moves file "/welcome.txt" to "/FOLDER/welcome.txt"
Then the HTTP status code should be "201"
+ And Downloading file "/FOLDER/welcome.txt"
+ And Downloaded content should start with "Welcome to your ownCloud account!"
+
+ Scenario: Moving and overwriting a file old way
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ And As an "user0"
+ When User "user0" moves file "/welcome.txt" to "/textfile0.txt"
+ Then the HTTP status code should be "204"
+ And Downloading file "/textfile0.txt"
+ And Downloaded content should start with "Welcome to your ownCloud account!"
+
+ Scenario: Moving a file to a folder with no permissions
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user1"
+ And user "user1" created a folder "/testshare"
+ And as "user1" creating a share with
+ | path | testshare |
+ | shareType | 0 |
+ | permissions | 1 |
+ | shareWith | user0 |
+ And As an "user0"
+ When User "user0" moves file "/textfile0.txt" to "/testshare/textfile0.txt"
+ Then the HTTP status code should be "403"
+ And Downloading file "/testshare/textfile0.txt"
+ And the HTTP status code should be "404"
+
+ Scenario: Moving a file to overwrite a file in a folder with no permissions
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user1"
+ And user "user1" created a folder "/testshare"
+ And as "user1" creating a share with
+ | path | testshare |
+ | shareType | 0 |
+ | permissions | 1 |
+ | shareWith | user0 |
+ And User "user1" copies file "/welcome.txt" to "/testshare/overwritethis.txt"
+ And As an "user0"
+ When User "user0" moves file "/textfile0.txt" to "/testshare/overwritethis.txt"
+ Then the HTTP status code should be "403"
+ And Downloading file "/testshare/overwritethis.txt"
+ And Downloaded content should start with "Welcome to your ownCloud account!"
+
+ Scenario: Copying a file
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ And As an "user0"
+ When User "user0" copies file "/welcome.txt" to "/FOLDER/welcome.txt"
+ Then the HTTP status code should be "201"
+ And Downloading file "/FOLDER/welcome.txt"
+ And Downloaded content should start with "Welcome to your ownCloud account!"
+
+ Scenario: Copying and overwriting a file
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ And As an "user0"
+ When User "user0" copies file "/welcome.txt" to "/textfile1.txt"
+ Then the HTTP status code should be "204"
+ And Downloading file "/textfile1.txt"
+ And Downloaded content should start with "Welcome to your ownCloud account!"
+
+ Scenario: Copying a file to a folder with no permissions
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user1"
+ And user "user1" created a folder "/testshare"
+ And as "user1" creating a share with
+ | path | testshare |
+ | shareType | 0 |
+ | permissions | 1 |
+ | shareWith | user0 |
+ And As an "user0"
+ When User "user0" copies file "/textfile0.txt" to "/testshare/textfile0.txt"
+ Then the HTTP status code should be "403"
+ And Downloading file "/testshare/textfile0.txt"
+ And the HTTP status code should be "404"
+
+ Scenario: Copying a file to overwrite a file into a folder with no permissions
+ Given using dav path "remote.php/webdav"
+ And As an "admin"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user1"
+ And user "user1" created a folder "/testshare"
+ And as "user1" creating a share with
+ | path | testshare |
+ | shareType | 0 |
+ | permissions | 1 |
+ | shareWith | user0 |
+ And User "user1" copies file "/welcome.txt" to "/testshare/overwritethis.txt"
+ And As an "user0"
+ When User "user0" copies file "/textfile0.txt" to "/testshare/overwritethis.txt"
+ Then the HTTP status code should be "403"
+ And Downloading file "/testshare/overwritethis.txt"
+ And Downloaded content should start with "Welcome to your ownCloud account!"
Scenario: download a file with range
Given using dav path "remote.php/webdav"