Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/dav/lib/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use OCP\SabrePluginEvent;
use Sabre\CardDAV\VCFExportPlugin;
use Sabre\DAV\Auth\Plugin;
use OCA\DAV\Connector\Sabre\TagsPlugin;

class Server {

Expand Down Expand Up @@ -172,7 +173,11 @@ public function __construct(IRequest $request, $baseUri) {
);
$this->server->addPlugin(
new \OCA\DAV\Connector\Sabre\QuotaPlugin($view));

$this->server->addPlugin(
new TagsPlugin(
$this->server->tree, \OC::$server->getTagManager()
)
);
}
});
}
Expand Down
16 changes: 8 additions & 8 deletions build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public function usingDavPath($davPath) {
$this->davPath = $davPath;
}

public function getFilesPath(){
public function getFilesPath($user){
$basePath = '';
if ($this->davPath === "remote.php/dav"){
$basePath = '/files/' . $this->currentUser . '/';
$basePath = '/files/' . $user . '/';
} else {
$basePath = '/';
}
Expand Down Expand Up @@ -243,7 +243,7 @@ public function asGetsPropertiesOfFolderWith($user, $path, $propertiesTable) {
*/
public function asTheFileOrFolderDoesNotExist($user, $entry, $path) {
$client = $this->getSabreClient($user);
$response = $client->request('HEAD', $this->makeSabrePath($path));
$response = $client->request('HEAD', $this->makeSabrePath($user, $path));
if ($response['statusCode'] !== 404) {
throw new \Exception($entry . ' "' . $path . '" expected to not exist (status code ' . $response['statusCode'] . ', expected 404)');
}
Expand Down Expand Up @@ -338,13 +338,13 @@ public function listFolder($user, $path, $folderDepth, $properties = null){
];
}

$response = $client->propfind($this->makeSabrePath($path), $properties, $folderDepth);
$response = $client->propfind($this->makeSabrePath($user, $path), $properties, $folderDepth);

return $response;
}

public function makeSabrePath($path) {
return $this->encodePath($this->davPath . '/' . ltrim($path, '/'));
public function makeSabrePath($user, $path) {
return $this->encodePath($this->davPath . $this->getFilesPath($user) . ltrim($path, '/'));
}

public function getSabreClient($user) {
Expand Down Expand Up @@ -435,7 +435,7 @@ public function userDeletesFile($user, $file) {
*/
public function userCreatedAFolder($user, $destination){
try {
$this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath() . ltrim($destination, $this->getFilesPath()), []);
$this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath($user) . ltrim($destination, $this->getFilesPath($user)), []);
} catch (\GuzzleHttp\Exception\ServerException $e) {
// 4xx and 5xx responses cause an exception
$this->response = $e->getResponse();
Expand Down Expand Up @@ -545,7 +545,7 @@ public function changeFavStateOfAnElement($user, $path, $favOrUnfav, $folderDept
];
}

$response = $client->proppatch($this->davPath . '/' . ltrim($path, '/'), $properties, $folderDepth);
$response = $client->proppatch($this->davPath . $this->getFilesPath($user) . ltrim($path, '/'), $properties, $folderDepth);
return $response;
}

Expand Down
38 changes: 38 additions & 0 deletions build/integration/features/favorites.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,41 @@ Feature: favorite
|{http://owncloud.org/ns}favorite|
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value ""

Scenario: Favorite a folder new endpoint
Given using dav path "remote.php/dav"
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/FOLDER"
Then as "user0" gets properties of folder "/FOLDER" with
|{http://owncloud.org/ns}favorite|
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"

Scenario: Favorite and unfavorite a folder new endpoint
Given using dav path "remote.php/dav"
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/FOLDER"
And user "user0" unfavorites element "/FOLDER"
Then as "user0" gets properties of folder "/FOLDER" with
|{http://owncloud.org/ns}favorite|
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value ""

Scenario: Favorite a file new endpoint
Given using dav path "remote.php/dav"
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/textfile0.txt"
Then as "user0" gets properties of file "/textfile0.txt" with
|{http://owncloud.org/ns}favorite|
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"

Scenario: Favorite and unfavorite a file new endpoint
Given using dav path "remote.php/dav"
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/textfile0.txt"
And user "user0" unfavorites element "/textfile0.txt"
Then as "user0" gets properties of file "/textfile0.txt" with
|{http://owncloud.org/ns}favorite|
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value ""