summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/connector/sabre
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-04-18 11:18:50 +0200
committerRoeland Jago Douma <rullzer@owncloud.com>2016-04-18 16:08:11 +0200
commitdcb2b37e248b912e05d6f74e9f69c605b13f9082 (patch)
treeae2f5adeb86bcd5cfb9ff5b73afe616916d89e90 /apps/dav/lib/connector/sabre
parentfd1740deb604894a8bef515d98c5992a392e6f0a (diff)
downloadnextcloud-server-dcb2b37e248b912e05d6f74e9f69c605b13f9082.tar.gz
nextcloud-server-dcb2b37e248b912e05d6f74e9f69c605b13f9082.zip
Add data-fingerprint property to webdav
Diffstat (limited to 'apps/dav/lib/connector/sabre')
-rw-r--r--apps/dav/lib/connector/sabre/filesplugin.php22
-rw-r--r--apps/dav/lib/connector/sabre/serverfactory.php11
2 files changed, 31 insertions, 2 deletions
diff --git a/apps/dav/lib/connector/sabre/filesplugin.php b/apps/dav/lib/connector/sabre/filesplugin.php
index 686d0863f91..dd4670da5fa 100644
--- a/apps/dav/lib/connector/sabre/filesplugin.php
+++ b/apps/dav/lib/connector/sabre/filesplugin.php
@@ -39,6 +39,7 @@ use Sabre\DAV\Tree;
use \Sabre\HTTP\RequestInterface;
use \Sabre\HTTP\ResponseInterface;
use OCP\Files\StorageNotAvailableException;
+use OCP\IConfig;
class FilesPlugin extends ServerPlugin {
@@ -55,6 +56,7 @@ class FilesPlugin extends ServerPlugin {
const OWNER_ID_PROPERTYNAME = '{http://owncloud.org/ns}owner-id';
const OWNER_DISPLAY_NAME_PROPERTYNAME = '{http://owncloud.org/ns}owner-display-name';
const CHECKSUMS_PROPERTYNAME = '{http://owncloud.org/ns}checksums';
+ const DATA_FINGERPRINT_PROPERTYNAME = '{http://owncloud.org/ns}data-fingerprint';
/**
* Reference to main server object
@@ -87,6 +89,11 @@ class FilesPlugin extends ServerPlugin {
private $downloadAttachment;
/**
+ * @var IConfig
+ */
+ private $config;
+
+ /**
* @param Tree $tree
* @param View $view
* @param bool $isPublic
@@ -94,10 +101,12 @@ class FilesPlugin extends ServerPlugin {
*/
public function __construct(Tree $tree,
View $view,
+ IConfig $config,
$isPublic = false,
$downloadAttachment = true) {
$this->tree = $tree;
$this->fileView = $view;
+ $this->config = $config;
$this->isPublic = $isPublic;
$this->downloadAttachment = $downloadAttachment;
}
@@ -125,6 +134,7 @@ class FilesPlugin extends ServerPlugin {
$server->protectedProperties[] = self::OWNER_ID_PROPERTYNAME;
$server->protectedProperties[] = self::OWNER_DISPLAY_NAME_PROPERTYNAME;
$server->protectedProperties[] = self::CHECKSUMS_PROPERTYNAME;
+ $server->protectedProperties[] = self::DATA_FINGERPRINT_PROPERTYNAME;
// normally these cannot be changed (RFC4918), but we want them modifiable through PROPPATCH
$allowedProperties = ['{DAV:}getetag'];
@@ -272,6 +282,18 @@ class FilesPlugin extends ServerPlugin {
$displayName = $owner->getDisplayName();
return $displayName;
});
+
+ $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) {
+ if ($node->getPath() === '/') {
+ return $this->config->getSystemValue('data-fingerprint', '');
+ }
+ });
+ }
+
+ if ($node instanceof \OCA\DAV\Files\FilesHome) {
+ $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) {
+ return $this->config->getSystemValue('data-fingerprint', '');
+ });
}
if ($node instanceof \OCA\DAV\Connector\Sabre\File) {
diff --git a/apps/dav/lib/connector/sabre/serverfactory.php b/apps/dav/lib/connector/sabre/serverfactory.php
index cab7a85d19f..5853370778d 100644
--- a/apps/dav/lib/connector/sabre/serverfactory.php
+++ b/apps/dav/lib/connector/sabre/serverfactory.php
@@ -137,8 +137,15 @@ class ServerFactory {
}
$objectTree->init($root, $view, $this->mountManager);
- $server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesPlugin($objectTree, $view, false,
- !$this->config->getSystemValue('debug', false)));
+ $server->addPlugin(
+ new \OCA\DAV\Connector\Sabre\FilesPlugin(
+ $objectTree,
+ $view,
+ $this->config,
+ false,
+ !$this->config->getSystemValue('debug', false)
+ )
+ );
$server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view));
if($this->userSession->isLoggedIn()) {