Skip to content

Commit

Permalink
Merge pull request #655 from nextcloud/add-quotaplugin-v2-stable9
Browse files Browse the repository at this point in the history
[stable9] Adding quota plugin to new dav endpoint
  • Loading branch information
MorrisJobke authored Jul 30, 2016
2 parents b4bd126 + 971f22e commit 18a92c2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apps/dav/lib/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ public function __construct(IRequest $request, $baseUri) {
)
)
);

$this->server->addPlugin(
new \OCA\DAV\Connector\Sabre\QuotaPlugin($view)
);
}
});
}
Expand Down
15 changes: 14 additions & 1 deletion build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ public function usingDavPath($davPath) {
$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();
Expand Down Expand Up @@ -347,7 +360,7 @@ public function userDeletesFile($user, $file) {
*/
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();
Expand Down
26 changes: 26 additions & 0 deletions build/integration/features/webdav-related.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 18a92c2

Please sign in to comment.