Browse Source

add propfind to detect encryption status

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
tags/v13.0.0beta1
Bjoern Schiessle 6 years ago
parent
commit
e83e1c7c23
No account linked to committer's email address
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      apps/dav/lib/Connector/Sabre/FilesPlugin.php

+ 7
- 1
apps/dav/lib/Connector/Sabre/FilesPlugin.php View File

@@ -66,6 +66,7 @@ class FilesPlugin extends ServerPlugin {
const DATA_FINGERPRINT_PROPERTYNAME = '{http://owncloud.org/ns}data-fingerprint';
const HAS_PREVIEW_PROPERTYNAME = '{http://nextcloud.org/ns}has-preview';
const MOUNT_TYPE_PROPERTYNAME = '{http://nextcloud.org/ns}mount-type';
const IS_ENCRYPTED_PROPERTYNAME = '{http://nextcloud.org/ns}is-encrypted';

/**
* Reference to main server object
@@ -146,7 +147,6 @@ class FilesPlugin extends ServerPlugin {
* @return void
*/
public function initialize(\Sabre\DAV\Server $server) {

$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
$server->xml->namespaceMap[self::NS_NEXTCLOUD] = 'nc';
$server->protectedProperties[] = self::FILEID_PROPERTYNAME;
@@ -161,6 +161,7 @@ class FilesPlugin extends ServerPlugin {
$server->protectedProperties[] = self::DATA_FINGERPRINT_PROPERTYNAME;
$server->protectedProperties[] = self::HAS_PREVIEW_PROPERTYNAME;
$server->protectedProperties[] = self::MOUNT_TYPE_PROPERTYNAME;
$server->protectedProperties[] = self::IS_ENCRYPTED_PROPERTYNAME;

// normally these cannot be changed (RFC4918), but we want them modifiable through PROPPATCH
$allowedProperties = ['{DAV:}getetag'];
@@ -343,6 +344,11 @@ class FilesPlugin extends ServerPlugin {
}
});

$propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function() use ($node) {
$result = $node->getFileInfo()->isEncrypted() ? '1' : '0';
return $result;
});

$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
return json_encode($this->previewManager->isAvailable($node->getFileInfo()));
});

Loading…
Cancel
Save