summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2016-06-30 15:05:13 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2016-06-30 15:05:13 +0200
commit3491400261c1454a9a30d3ec96969573330120cc (patch)
tree8979fd7e5dfa26198809042abddcee1a935fc183 /build
parent723cf78169e7dc7138dedf70fa694b202060d8f5 (diff)
downloadnextcloud-server-3491400261c1454a9a30d3ec96969573330120cc.tar.gz
nextcloud-server-3491400261c1454a9a30d3ec96969573330120cc.zip
add some additonal permission checks to the webdav backend
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/WebDav.php18
-rw-r--r--build/integration/features/webdav-related.feature32
2 files changed, 49 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index 0a4624ccc2b..785c20325bb 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -64,9 +64,25 @@ trait WebDav {
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
}
+
+
/**
- * @When /^Downloading file "([^"]*)" with range "([^"]*)"$/
+ * @When /^User "([^"]*)" copies file "([^"]*)" to "([^"]*)"$/
+ * @param string $user
+ * @param string $fileSource
+ * @param string $fileDestination
*/
+ public function userCopiesFileTo($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) {
+ // 4xx and 5xx responses cause an exception
+ $this->response = $e->getResponse();
+ }
+ }
+
public function downloadFileWithRange($fileSource, $range){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
$headers['Range'] = $range;
diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature
index c6d2919db8d..577c85564bf 100644
--- a/build/integration/features/webdav-related.feature
+++ b/build/integration/features/webdav-related.feature
@@ -241,3 +241,35 @@ Feature: webdav-related
| 0 |
| 1 |
| 3 |
+
+
+ Scenario: Copying files into a folder with edit permissions
+ Given using dav path "remote.php/webdav"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user1"
+ And user "user1" created a folder "/testcopypermissionsAllowed"
+ And as "user1" creating a share with
+ | path | testcopypermissionsAllowed |
+ | shareType | 0 |
+ | permissions | 31 |
+ | shareWith | user0 |
+ And User "user0" uploads file with content "copytest" to "/copytest.txt"
+ When User "user0" copies file "/copytest.txt" to "/testcopypermissionsAllowed/copytest.txt"
+ Then the HTTP status code should be "201"
+
+
+ Scenario: Copying files into a folder without edit permissions
+ Given using dav path "remote.php/webdav"
+ And user "user0" exists
+ And user "user1" exists
+ And As an "user1"
+ And user "user1" created a folder "/testcopypermissionsNotAllowed"
+ And as "user1" creating a share with
+ | path | testcopypermissionsNotAllowed |
+ | shareType | 0 |
+ | permissions | 1 |
+ | shareWith | user0 |
+ And User "user0" uploads file with content "copytest" to "/copytest.txt"
+ When User "user0" copies file "/copytest.txt" to "/testcopypermissionsNotAllowed/copytest.txt"
+ Then the HTTP status code should be "403"