diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-07-30 13:58:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-30 13:58:22 +0300 |
commit | 18a92c26cf4740424fc24557b71279e6cea9c12f (patch) | |
tree | 258dd9d8059e024cd15fd634b84d92f602cf3452 | |
parent | b4bd1260080b3c871d24fdce07c2bcf81b76518b (diff) | |
parent | 971f22edc5d104f53313bd62241622f462b7c2d4 (diff) |
Merge pull request #655 from nextcloud/add-quotaplugin-v2-stable9
[stable9] Adding quota plugin to new dav endpoint
-rw-r--r-- | apps/dav/lib/server.php | 4 | ||||
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 15 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 26 |
3 files changed, 44 insertions, 1 deletions
diff --git a/apps/dav/lib/server.php b/apps/dav/lib/server.php index 4b7d62b8cef..de664d080f2 100644 --- a/apps/dav/lib/server.php +++ b/apps/dav/lib/server.php @@ -141,6 +141,10 @@ class Server { ) ) ); + + $this->server->addPlugin( + new \OCA\DAV\Connector\Sabre\QuotaPlugin($view) + ); } }); } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 7d2f4a49c3e..64bcbb12dc0 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -47,6 +47,19 @@ trait WebDav { $this->davPath = $davPath; } + + /** + * @return string + */ + public function getFilesPath() { + if ($this->davPath === 'remote.php/dav') { + $basePath = '/files/' . $this->currentUser . '/'; + } else { + $basePath = '/'; + } + return $basePath; + } + public function makeDavRequest($user, $method, $path, $headers, $body = null){ $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path"; $client = new GClient(); @@ -347,7 +360,7 @@ trait WebDav { */ public function userCreatedAFolder($user, $destination){ try { - $this->response = $this->makeDavRequest($user, "MKCOL", $destination, []); + $this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath() . ltrim($destination, $this->getFilesPath()), []); } catch (\GuzzleHttp\Exception\ServerException $e) { // 4xx and 5xx responses cause an exception $this->response = $e->getResponse(); diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index 577c85564bf..cd754c0de40 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -273,3 +273,29 @@ Feature: webdav-related 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" + + Scenario: Uploading a file having 0B as quota + Given using dav path "remote.php/dav" + And As an "admin" + And user "user0" exists + And user "user0" has a quota of "0 B" + And As an "user0" + When User "user0" uploads file "data/textfile.txt" to "/files/user0/asdf.txt" + Then the HTTP status code should be "507" + Scenario: Uploading a file as recipient using webdav new endpoint having quota + Given using dav path "remote.php/dav" + And As an "admin" + And user "user0" exists + And user "user1" exists + And user "user0" has a quota of "10 MB" + And user "user1" has a quota of "10 MB" + And As an "user1" + And user "user1" created a folder "/testquota" + And as "user1" creating a share with + | path | testquota | + | shareType | 0 | + | permissions | 31 | + | shareWith | user0 | + And As an "user0" + When User "user0" uploads file "data/textfile.txt" to "/files/user0/testquota/asdf.txt" + Then the HTTP status code should be "201" |